如何在Linux Fedora,CentOS和RedHat中安装Mariadb / Mysql Server?

Mariadb is an open source database forked from another popular open source database MySQL. MariaDB developers are original developers of the MySQL. After Oracle get management of the MySQL project they become unhappy with the management of the Oracle and started MariaDB project. Latest available version for MariaDB was 10.1.18 as writing but we will get what our distribution provides us.

Mariadb是从另一个流行的开源数据库MySQL派生而来的开源数据库。 MariaDB开发人员是MySQL的原始开发人员。 在Oracle获得MySQL项目的管理后,他们对Oracle的管理不满意,并启动了MariaDB项目。 撰写本文时,MariaDB的最新可用版本为10.1.18,但我们将获得发行版提供的内容。

安装MariaDB (Install MariaDB)

We will use dnf inorder to install MariaDB. The package is called as mariadb-server .

我们将使用dnf来安装MariaDB。 该软件包称为mariadb-server

$ sudo dnf install mariadb-server -y

OR we can use traditional yum package manager like below.

或者我们可以使用传统的yum软件包管理器,如下所示。

$ sudo yum install mariadb-server -y

使用systemctl启动MariaDB数据库服务 (Start MariaDB Database Service with systemctl)

After installing the required MariaDB packages we will list current status of the MariaDB serviceor daemon with <a href="https://www.poftut.com/linux-systemctl-service-management-tutorial/" target="_blank" rel="noopener noreferrer">systemctl</a> command like below.

安装所需的MariaDB软件包后,我们将使用<a href="https://www.poftut.com/linux-systemctl-service-management-tutorial/" target="_blank" rel="noopener noreferrer">systemctl</a>命令,如下所示。

$ systemctl status mariadb  
● mariadb.service - MariaDB 10.1 database server 
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) 
   Active: inactive (dead)

It is stopped now we will start the service and look to the status again.

现在已停止,我们将启动服务并再次查看状态。

$ sudo systemctl start mariadb  
$ sudo systemctl status mariadb 
● mariadb.service - MariaDB 10.1 database server 
   Loaded: loaded (/usr/lib/systemd/system/mariadb.service; disabled; vendor preset: disabled) 
   Active: active (running) since Sun 2016-10-16 02:22:27 UTC; 3s ago 
  Process: 4775 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS) 
  Process: 4587 ExecStartPre=/usr/libexec/mysql-prepare-db-dir %n (code=exited, status=0/SUCCESS) 
  Process: 4551 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS) 
 Main PID: 4746 (mysqld) 
   Status: "Taking your SQL requests now..." 
    Tasks: 26 (limit: 512) 
   Memory: 191.8M 
      CPU: 1.306s 
   CGroup: /system.slice/mariadb.service 
           └─4746 /usr/libexec/mysqld --basedir=/usr 
 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: See the MariaDB Knowledgebase at http://mariadb.com/kb or the 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: MySQL manual for more instructions. 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: Please report any problems at http://mariadb.org/jira 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: The latest information about MariaDB is available at http://mariadb.org/. 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: You can find additional information about the MySQL part at: 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: http://dev.mysql.com 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: Support MariaDB development by buying support/new features from MariaDB 
Oct 16 02:22:27 poftut3 mysql-prepare-db-dir[4587]: Corporation Ab. You can contact us about this at [email protected] 
Oct 16 02:22:27 poftut3 mysqld[4746]: 2016-10-16  2:22:27 140436492912832 [Note] /usr/libexec/mysqld (mysqld 10.1.18-MariaDB) startin 
Oct 16 02:22:27 poftut3 systemd[1]: Started MariaDB 10.1 database server.

登录到MariaDB控制台 (Login To The MariaDB Console)

We will login to the MariaDb Console. As stated before MariaDB forked from MySQL and most of the tools are compatible with the MySQL. We will use MySQL database management tool for this. We will provide root user and password.

我们将登录到MariaDb控制台。 如前所述,MariaDB是从MySQL分叉的,大多数工具都与MySQL兼容。 我们将为此使用MySQL数据库管理工具。 我们将提供root用户名和密码。

$ mysql -u root -p 
Enter password:  
Welcome to the MariaDB monitor.  Commands end with ; or \g. 
Your MariaDB connection id is 2 
Server version: 10.1.18-MariaDB MariaDB Server 
 
Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. 
 
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. 
 
MariaDB [(none)]>

获得MariaDB帮助 (Getting Help For MariaDB)

By issuing help command we can list basic commands.

通过发布帮助命令,我们可以列出基本命令。

MariaDB [(none)]> \h 
 
General information about MariaDB can be found at 

   
   
MariaDB Foundation
MariaDB [(none)]> \h 
 
General information about MariaDB can be found at 

   
   
MariaDB Foundation

列出MariaDB中的数据库 (List Databases in MariaDB)

We can use show databases; command to list databases in MariaDB

我们可以使用show databases ; 命令来列出MariaDB中的数据库

MariaDB [(none)]> show databases; 
+--------------------+ 
| Database           | 
+--------------------+ 
| information_schema | 
| mysql              | 
| performance_schema | 
| test               | 
+--------------------+ 
4 rows in set (0.00 sec)
LEARN MORE  How To Center Table In HTML?
了解更多如何在HTML中居中显示表格?

如何在Linux Fedora,CentOS和RedHat中安装Mariadb / Mysql Server? 信息移植 (How to Install Mariadb / Mysql Server in Linux Fedora, CentOS and RedHat? Infografic)

如何在Linux Fedora,CentOS和RedHat中安装Mariadb / Mysql Server?信息移植
How to Install Mariadb / Mysql Server in Linux Fedora, CentOS and RedHat? Infografic
如何在Linux Fedora,CentOS和RedHat中安装Mariadb / Mysql Server? 信息移植

翻译自: https://www.poftut.com/how-to-install-mariadb-mysql-server-in-linux-fedora/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值