Here are steps you should do to upgrade your older MariaDB 10.1.x to the latest version of MariaDB 10.1.x.
0. Prepare for upgrade
- make sure no traffic is coming to database server
- make backup of configuration files /etc/my.cnf*
- backup all your databases running on the server in case something goes wrong during upgrade
1. Update yum repository config located in /etc/yum.repos.d/MariaDB.repo with new content. You can generate your config file here: https://downloads.mariadb.org/mariadb/repositories/
e.g. in our case the content looks like:
[MariaDB] gpgcheck=1 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB name=MariaDB 10.0 CentOS repository list - created 2015-02-06 13:47 UTC humanname=MariaDB 10.0 CentOS repository list - created 2015-02-06 13:47 UTC baseurl=https://yum.mariadb.org/10.0/centos6-amd64
And we will replace it with new config:
[mariadb] name = MariaDB baseurl = https://yum.mariadb.org/10.1/centos6-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1
2. Stop mysql service
service mysql stop
3. Update MariaDB installation files
yum update
In case update will fail with message like this, you need to install MariaDB manually:
****************************************************************** A MySQL or MariaDB server package (MariaDB-server-10.0.21-1.el6.x86_64) is installed. Upgrading directly from MySQL 10.0 to MariaDB 10.1 may not be safe in all cases. A manual dump and restore using mysqldump is recommended. It is important to review the MariaDB manual's Upgrading section for version-specific incompatibilities. A manual upgrade is required. - Ensure that you have a complete, working backup of your data and my.cnf files - Shut down the MySQL server cleanly - Remove the existing MySQL packages. Usually this command will list the packages you should remove: rpm -qa | grep -i '^mysql-' You may choose to use 'rpm --nodeps -ev <package-name>' to remove the package which contains the mysqlclient shared library. The library will be reinstalled by the MariaDB-shared package. - Install the new MariaDB packages supplied by Monty Program AB - Ensure that the MariaDB server is started - Run the 'mysql_upgrade' program This is a brief description of the upgrade process. Important details can be found in the MariaDB manual, in the Upgrading section. ****************************************************************** error: %pre(MariaDB-server-10.1.8-1.el6.x86_64) scriptlet failed, exit status 1 Error in PREIN scriptlet in rpm package MariaDB-server-10.1.8-1.el6.x86_64 error: install: %pre scriptlet failed (2), skipping MariaDB-server-10.1.8-1.el6 Verifying : MariaDB-server-10.1.8-1.el6.x86_64 MariaDB-server-10.0.21-1.el6.x86_64 was supposed to be removed but is not! Verifying : MariaDB-server-10.0.21-1.el6.x86_64 Failed: MariaDB-server.x86_64 0:10.0.21-1.el6 MariaDB-server.x86_64 0:10.1.8-1.el6 Complete!
In our case I have found all packages related to Mariadb with command
rpm -qa | grep -i '^MariaDB'
And removed them with commands like:
yum remove MariaDB-server
And than installed MariaDB server with command:
yum install MariaDB-server
Update configuration files in /etc/my.cnf.d/ directory. Some files could be overwritten during the installation of new MariaDB version.
4. start mysql service
service mysql start
5. run mysql upgrade
It could take a while until all upgrade steps are finished (6 steps), especially if you have hundreds of databases and tables on your server. Don't forget, that the mysql process has to be running before you can start upgrade.
mysql_upgrade -u root -p
6. Post-upgrade steps
- Once the mysql upgrade finished, you should review mysql error log if all works as expected.
- Review my.cnf for new configuration settings - new version comes with ton of new features and configuration options - why not to profit from them.