STS Host and Tech Knowledge base
Search
Close this search box.

Upgrade MySQL to MariaDB on a cPanel server

MariaDB is “An enhanced, drop-in replacement for MySQL. It is made by the MySQL developers and guaranteed to stay open source. In this article we will show you how to upgrade MYSQL to MariaDB in cPanel/WHM for all database activity on your server but please note that, cPanel/WHM no longer maintains MySQL on your system, so it is on the Systems Administrator to manage and maintain any updates and maintenance on the database software.

Upgrade MySQL to MariaDB on a cPanel server

  • Backup existing MySQL data, you can use this using below commands:
				
					cp -rvf /var/lib/mysql /var/lib/mysql_backup
mv /etc/my.cnf /etc/my.cnf-old
				
			
  • Take dump of all database using
				
					mysqldump --all-databases > all-databases.sql
				
			
  • Disable the targets, so cPanel no longer handles MySQL updates, the following will mark the versions of MySQL we distribute as uninstalled so they are no longer maintained by cPanel/WHM
				
					/scripts/update_local_rpm_versions –edit target_settings.MySQL50 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL51 uninstalled
/scripts/update_local_rpm_versions –edit target_settings.MySQL55 uninstalled
				
			
  • Remove existing MySQL RPM’s so theres a clean slate for MariaDB. The below command will uninstall the MySQL RPM’s
				
					/scripts/check_cpanel_rpms --fix --targets=MySQL50,MySQL51,MySQL55
				
			
  • Install MariaDB using the  following command:
				
					yum install MariaDB-server MariaDB-client MariaDB-devel
				
			
				
					/etc/init.d/mysql start
mysql_upgrade
/etc/init.d/mysql restart
				
			
  • Now start the MySQL service.
				
					systemctl start mysql.service
				
			
  • Then upgrade the mysql.
				
					mysql_upgrade
				
			
  • After the upgrade restarts the mysql service.
				
					systemctl restart mysql.service
				
			
  • Finally recompile Apache with PHP to finish the replacement
				
					/scripts/easyapache --build
				
			
  • Now we have replaced MySQL with MariaDB. You can verify it by executing the following command.
				
					mysql -V
				
			

Share Article

Related Articles