This tutorial shows the step-by-step guide on upgrading and converting from MySQL version 5.1 firstly to MariaDB version 5.5, and then subsequently to MariaDB 10.0, in CentOS 6.6 system. The procedure should works on most Red Hat Enterprise Linux (RHEL), CentOS, Fedora, Scientific Linux and similar distributions version 5, 6 and 7.
Part 1 – Install and Upgrade MySQL 5.1 to MariaDB 5.5
- Make a backup of MySQL databases:
mysqldump --all-databases > /tmp/backup.sql
Backup the MySQL configuration file:
cp /etc/my.cnf /etc/my.cnf.bak
You may also want to backup the complete directory of databases, i.g. /var/lib/mysql. In this case, stop the MySQL daemon with service mysql stop then copy: cp -R /var/lib/mysql /tmp/mysql_lib_backup.
- Ensure that all software packages are up-to-date before upgrading:
- Visit MariaDB repository configuration generator to setup a MariaDB 5.5 repo by selecting your distro and release.
Create a file named MariaDB.repo (or any name you prefer) in /etc/yum.repos.d directory, and paste the custom MariaDB YUM repository entry for CentOS generated into it.
For CentOS 6.6, the content of /etc/yum.repos.d/MariaDB.repo is:
# MariaDB 5.5 CentOS repository list - created 2015-01-01 22:33 UTC # http://mariadb.org/mariadb/repositories/ [mariadb] name = MariaDB baseurl = http://yum.mariadb.org/5.5/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
- Clean the repository cache information:
yum clean all
- Stop the MySQL service if it's still running:
service mysqld stop
- Uninstall and remove MySQL 5.1:
yum remove mysql mysql-server
- Install MariaDB 5.5:
yum install mysql-server
- When installation is completed, start the MariaDB database service:
service mysql start
- Run the MariaDB upgrade script:
- Verify that the MySQL is now MariaDB 5.5 by logging into the database system using command-line client:
The output should indicates MariaDB:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 12
Server version: 5.5.41-MariaDB MariaDB Server
Copyright (c) 2000, 2014, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
If you want to use MariaDB 10, you can continue to Part 2 - Upgrade MySQL/MariaDB 5.5 to MariaDB 10.0.