How do I move from MariaDB to MySQL?

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:

  1. Run sudo systemctl stop mysql
  2. Uninstall MariaDB with sudo apt-get --purge remove "mysql*"
  3. Remove the configuration file if it exists: sudo rm /etc/my.cnf
  4. Install MySQL with :
sudo apt update
sudo apt install mysql-server
sudo mysql_secure_installation
  1. 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

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct