Question

Can I switch from MySQL to MariaDB for WordPress site without any modifications or conversions?

Posted May 9, 2020 3k views
MySQLWordPressMariaDB

I’m having so many issues with MySQL 8 on a WordPress site that I’m starting to think on using a different platform.

I’m not a super tech savvy user on database, but I read that MariaDB offers better performance out of the box, so the question is:

  1. Can just simply set up an Ubuntu server with MariaDB with apache 2.4 and php 7.4 and dump the MySQL database that I have on the WordPress site on MariaDB?
  2. Is there any process to change database platforms?
  3. Are the commands between mysql and mariadb the same?
  4. Is mariadb better user friendlier than mysql?
  5. Is it worth it?

Thanks,

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

×
1 answer

Hello, @mhweb

  1. Yes you can spin up a new droplet with MariaDB and then just export your database and import it on the new MariaDB droplet. The process is really simple.

  2. You can always upgrade from MySQL to MariaDB. We have a little article on what the process involves:

https://www.digitalocean.com/community/tutorials/switching-to-mariadb-from-mysql

Backup your databases and uninstall MySQL

What you need is to backup all of your databases which you can do with a mysqldump command:

mysqldump --all-databases --user=root --password --master-data > backupdb.sql

You can also backup your/etc/my.cnf file

sudo cp /etc/mysql/my.cnf /opt/my.cnf.bak

Stop the MySQL service:

service mysql stop

Uninstall the MySql server, associated utilities amd MySql user.

sudo apt-get remove mysql-server mysql-client mysql-common
sudo deluser mysql
sudo rm -rf /var/lib/mysql

Install MariaDB

You need to add MariaDB repository on your system in order to Install MariaDB.

sudo apt-get install software-properties-common
sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
sudo add-apt-repository 'deb [arch=amd64] http://mirror.zol.co.zw/mariadb/repo/10.3/ubuntu bionic main'
sudo apt update
sudo apt -y install mariadb-server mariadb-client
sudo /etc/init.d/mariadb start

Finally you want to import the previously exported databases back to MariaDB server as follow

mysql -u root -p < backupdb.sql

Note: It’s important to backup your databases and the /etc/my.cnf file in case something goes wrong with the process, but I will also recommend you to take a snapshot of your droplet before starting the process as in this way you will have an a working copy of your droplet and you can always restore your droplet in case this is needed.

  1. The commands for MySQL and MariaDB are the same, there are some small changes but generally you will feel comfortable with the new version.

  2. Both MariaDB and MySQL require knowledge in order to use them, but I can say that MariaDB is not more complicated than MySQL and that both are easy user friendly, but users often stick with MariaDB because it will almost definitely remain open source.

  3. MariaDB stands tall as a more powerful database as compared to MySQL. Because it provides several advanced features which are till now not introduced by MySQL, and are neither supported in its compatible apps. Many users choose MariaDB over MySQL due to MariaDB’s frequent security releases. While this does not necessarily mean MariaDB is more secure, it does indicate the development community takes security seriously.

Hope this helps!

Regards,
Alex

by Etel Sverdlov
Have you been thinking of making the switch? Here's our article on moving from from MySQL to MariaDB.
Submit an Answer