使用 YUM 命令在 CentOS linux 上安装 MariaDB 10.0

玛丽亚数据库 10.0 是开发版 玛丽亚数据库. 它建立在 玛丽亚数据库 5.5 系列 具有向后移植的功能 MySQL 5.6 以及其他任何地方都没有的全新功能。
对于 CentOS、RedHat 和 Fedora,强烈建议使用从存储库安装 百胜. 此页面将引导您完成简单的步骤。

添加 MariaDB YUM 存储库

我们强烈建议使用自定义 玛丽亚数据库 要安装的存储库湖在下面创建一个 repo 文件/etc/yum.repos.d/MariaDB.repo, 复制并粘贴以下行 MariaDB 存储库

在 Centos 6.5 32 位上添加存储库

# vi /etc/yum.repos.d/MariaDB.repo

并粘贴以下行:

# MariaDB 10.0 CentOS repository list - created 2014-03-12 12:46 UTC # https://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = https://yum.mariadb.org/10.0/centos6-x86 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1

在 Centos 6.5 64 位上添加存储库

# vi /etc/yum.repos.d/MariaDB.repo

并粘贴以下行:

# MariaDB 10.0 CentOS repository list - created 2014-03-12 12:47 UTC # https://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = https://yum.mariadb.org/10.0/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1

上面的示例文件包括一个 密钥 行自动获取 GPG 密钥 我们用来签署存储库。 此键使 百胜转速核实正直包裹下载.

使用 YUM 安装 MariaDB 10.0

有了 repo 文件,您现在可以安装 玛丽亚数据库 像这样:

# yum install MariaDB-server MariaDB-client -y

启动 MariaDB

在完成安装过程后, 开始 玛丽亚数据库 宽度以下命令:

# service mysql start

或者

# /etc/init.d/mysql start

玛丽亚数据库 开机启动:

# chkconfig mysql on

安装后保护 MariaDB

设置(更改)root 密码 删除匿名用户 禁止远程登录 删除测试数据库并访问它 重新加载权限表

要保护 MariaDB 安装,请输入以下命令:

#  mysql_secure_installation

示例输出:

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): 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 YOUR PASSWORD Re-enter new password: REPEAT YOUR PASSWORD 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!

重启 MariaDB:

# service mysql restart

尝试连接到 MariaDB:

# mysql -u root -p

就是这样。 对于问题,请使用评论。
参考: https://mariadb.com/kb/en/installing-mariadb-with-yum/