How do I move from MariaDB to MySQL?
Linode
Linode Staff
Hi there,
I am wondering if it is possible to migrate my database from MariaDB to MySQL so I can use ServerPilot or a similar service?
1 Reply
Hello,
You can definitely switch from MariaDB to MySQL. MariaDB is a fork of MySQL so it is a relatively straightforward process. First you will need to perform a datadump using mysqldump:
Use mysqldump to Back Up MySQL or MariaDB
Once you have the dump you can start to migrate to MySQL. Follow the next steps to do so:
- Run
sudo systemctl stop mysql
- Uninstall MariaDB with
sudo apt-get --purge remove "mysql*"
- Remove the configuration file if it exists:
sudo rm /etc/my.cnf
- Install MySQL with :
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
- Initiate your database backup with:
mysql -uroot -p < database_backup.sql
There you have it!
Keep in mind, you can easily move back to MariaDB if you need to.
Best,
Aaron
Linode Customer Support