在CentOS,RHEL 6/5,Fedora中使用Yum库安装MariaDB5.5

MariaDB一个增强的,可以直接替代MySQL。 MariaDB可能是为数据库专业人员寻找一个 强大的可扩展的可靠的SQL服务器的一个更好的选择。 MariaDB比MySQL有一些更新的功能。使用下面的链接阅读MariaDB和MySQL之间的功能对比 MariaDB特点VS MySQL MySQL VS MariaDB之间的兼容性 了解更多关于MariaDB 本文将帮助你在CentOS,RHEL 6/5和Fedora 19/18/17系统上使用Yum安装MariaDB5.5

第1步:添加MariaDB Yum库

首先,我们需要在我们的系统添加MariaDB Yum软件库。下面是存储库的列表。在您的系统上创建新的 repo 文件 /etc/yum.repos.d/mariadb.repo 并按你的操作系统添加指定的代码。
CentOS/RHEL 6(64位)
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel6-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
CentOS/RHEL-6(32位)
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel6-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
CentOS/RHEL-5 (64位)
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel5-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
CentOS / RHEL-5 (32位)
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/rhel5-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Fedora 19/18/17 (64位)
请在下面设置根据您使用的Fedora版本更改版本(红色高亮显示)。点击 这里查看所有可用的存储库。
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora19-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
Fedora 19/18/17 (32位)
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/5.5/fedora19-x86
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

第2步:安装MariaDB

使用以下命令在系统上安装MariaDB
# yum install MariaDB-server MariaDB-client

第3步:启动MariaDB服务

在你的系统中安装MariaDB之后,让我们用下面的命令来启动服务。
# service mysql start

第4步:安全MariaDB安装

最后,我们需要确保我们的MariaDB安装与密码,并做一些其他的更改。要做到命令行运行这个安全的安装脚本。
# mysql_secure_installation
安全的安装脚本会要求用户输入一些信息,按照安装为每个输出下面显示,所有的用户输入信息都加粗了。
/usr/bin/mysql_secure_installation: line 379: find_mysql_client: command not found

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): [Press Enter]
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y
New password: [Enter Password Here]
Re-enter new password: [Re-enter Password Here]
Password updated successfully!
Reloading privilege tables..
 ... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

第5步:验证连接

安装后,连接到MariaDB服务器,使用下面的命令
[root@localhost lib]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 9
Server version: 5.5.34-MariaDB MariaDB Server

Copyright (c) 2000, 2013, Oracle, Monty Program Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]>
您还可以 安装phpMyAdmin使用web界面,它提供了方便的工作方式来管理MariaDB。
赞(52) 打赏
未经允许不得转载:优客志 » 系统运维
分享到:

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏