centos 7.X yum install MariaDB 10.x

11 年 ago jony centos 7.X yum install MariaDB 10.x已关闭评论

Installing MariaDB on CentOS 7

Now that MariaDB is the default database server for CentOS, all you have to do is run the commands below to install it. The problem is, it downloads and installs an older but stable version of MariaDB.

If you want to install the latest version of MariaDB, you must add its software repository to your machine and install. To do that, run the commands below to create a repository file.

所有版本:http://yum.mariadb.org/

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

Then copy and paste the lines below into the file and save it.

[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.0/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1

Finally, run the commands below to install MariaDB 10 on your machine.

yum install MariaDB-server MariaDB-client

原来已经安装或者需要修复安装

yum reinstall MariaDB-server MariaDB-client

If you run into trouble with errors that MariaDB can’t be installed because of conflict with mariadb-libs-xxxx, run the commands below to remove it then re-run the installation commands above.

 yum remove mariadb-libs*

It should also remove the postfix package. Re-run the commands above to install MariaDB.

When the installation completes, run the commands below to start MariaDB server.

/etc/init.d/mysql start

Next, run the commands below to secure your database server.

mysql_secure_installation

Next, choose Yes for the rest of the prompts until you’re done.

  • Enter current password for root (enter for none): press Enter
  • Set root password? Y
    • New password: Type new root password
    • Re-enter new password: Confirm the password
  • Remove anonymous users? Y
  • Disallow root login remotely? Y
  • Remove test database and access to it? Y
  • Reload privilege tables now? Y

The final thing go do is replace the default cnf.ini file in the /etc/ directory with one defined for MariaDB. Go to this location:

cd /usr/share/mysql

And use one of the pre-defined cnf.ini configurations available (Huge, Medium and Small) Memory sizes.

Backup your currnet cnf.ini file.

 mv /etc/cnf.ini /etc/cnf.ini.bak

Then copy one of the pre-defined configuration for MariaDB.

cp /usr/share/mysql/my-huge.cnf /etc/cnf.ini

Restart MaraiDB and you’re done.

Enjoy!

http://www.if-not-true-then-false.com/2013/install-mariadb-on-fedora-centos-rhel/