Moving from MySQL to MariaDB on a Linux Ubuntu Server Offering Shared Hosting

This video shows the process of moving a web hosting server from MySQL to MariaDB

You will see at the end that PHPMyAdmin still displays MySQL but I fix this by running this additional command and then restarting Apache2:
sudo apt-get install php-client
sudo service apache2 restart

Full set of commands executed in video are:

Make a backup folder and backup all databases:
cd /home
sudo mkdir backup
sudo mysqldump -u root -p –all-databases > alldb.sql

Remove MySQL:
sudo apt-get remove –purge mysql-server
sudo apt-get autoremove
sudo apt-get autoclean

Install MariaDB
sudo apt-get install mariadb-server

Reset MariaDB otherwise it refuses to work -this drops all user databases
sudo rm -r /var/lib/mysql* # Remove any old database setup
sudo mysql_install_db -u mysql # Install new database
sudo systemctl unmask mysql.service # Emables the service for systemd
sudo service mysql start # start the service.

Import the databases -may need without the -p now:
mysql -u root -p < alldb.sql

Secure the installation -root password will be blank:
sudo mysql_secure_installation

Upgrade -will not be required if everything was dropped and re-imported above
sudo mysql_upgrade -u root -p

Also needed this otherwise PHPMyAdmin still showed MySQL was being used:
sudo apt-get install php-client

Finally restart Apache2:
sudo service apache2 restart

0 comments… add one

Leave a Comment