Migration from MySQL To MariaDB - (r)

May 4, 2023
Learn how to migrate from MySQL to MariaDB

Share this on

If you're considering migrating from MySQL to MariaDB, there's a solid reason to switch. As one of the first databases management systems (DBMS) platforms, MySQL has dominated the market for quite a while and is still a remarkably popular.

Yet, businesses are slowly shifting away from MariaDB due to its inefficient processing speed and its inefficiency when handling large amounts of data. A lot of organizations are turning to MariaDB.

This article will guide you in the process of migrating your database out of MySQL into MariaDB.

How To Change Databases From MySQL To MariaDB

Migrating from MySQL switching to MariaDB is ridiculously easy. You can break down the whole process into two significant actions:

  1. Log on to your MariaDB server and load the backup file. This will create the database.

MariaDB has compatibility with MySQL, so you won't be able to transfer your database.

After migrating the database you have from MySQL to MariaDB and double-checking to ensure whether the tables are correct You can then update your website to pull data from MariaDB rather than MySQL.

Requirements

In case you're considering transferring between MySQL to MariaDB which is MariaDB, you'll already have at least a MySQL database that contains some of the data you want to move.

phpMyAdmin administration tool
PHPMyAdmin

If you do not have phpMyAdmin, don't worry. The guide contains instructions you need to run in your terminal for replicating identical actions in MySQL and MariaDB.

Out With MySQL

Create a backup of your target database in MySQL. Start your MySQL server, and then log into your MySQL database with the phpMyAdmin program. From WAMP or XAMPP, you can access phpMyAdmin by navigating to http://localhost/phpMyAdmin/.

phpMyAdmin log-in page for MySQL server
phpMyAdmin log-in page
WordPress database on phpMyAdmin using MySQL
WordPress database on phpMyAdmin

Choose on the export tab over the tables and select for the SQL format. You'll import it into MariaDB at a later date.    VkcmRoPDxwnVWnLCqeYC    Exporting WordPress database into SQL format

Select Goto to download the backup of your database onto your computer local as a SQL file. Alternatively, if you don't have phpMyAdmin or prefer using commands, use the following procedure to dump your database into an SQL file. Change you-name and your-pass with the username of your database and password.

 $ mysqldump --user=your-name --password="your-pass" wordpress > wordpress.sql

Finally, uninstall MySQL.

MariaDB In MariaDB

Make sure you've got MariaDB installed on the local machine. There's no need to perform this manually if you're employing WAMP, XAMPP, or similar distributions pre-installed by MariaDB.

Now it's time to transfer the backup MySQL file in MariaDB. You must stop the MySQL server via your server admin panel. Log out of the MySQL server, and then log into the MariaDB server (just switch between MySQL to MariaDB when signing in to phpMyAdmin).

phpMyAdmin log-in page for MariaDB server
phpMyAdmin login page for MariaDB server

In the admin panel, make a database on the admin panel. This can be done in phpMyAdmin by clicking New and giving the database a name, and pressing Create.

WordPress database on phpMyAdmin using MariaDB
WordPress database is hosted on phpMyAdmin with MariaDB

Open the database that you just created, then select the import tab on the right and load the backup by clicking the Choose File option or Select File option.

Importing WordPress database
Importing WordPress database

Select "Go" to start loading the file. The process may be lengthy, but when everything is working, phpMyAdmin informs you that your query has been successful.

Query success message
Success message

If you'd prefer using the command line instead take these steps.

Log on to your MariaDB server and set up your new database in the following manner:

$ mysql --user=your-name --password="your-pass" -e "CREATE DATABASE wordpress";

The backup file should be loaded into MariaDB.

$ mysql --user=your-name --password="your-pass" --database=wordpress 

Once you have successfully imported the files from MySQL to MariaDB the cursor will be active once more.

How to Make Updates To Your WordPress Site

After moving from MySQL and MySQL to MariaDB It's now time to update your WordPress website to use the new database. For this to happen it is simply necessary to change your website's wp-config.php file with the new database details:

// ** MariaDB settings** //
 
 define('DB_NAME', 'database_name_here');
 define('DB_USER', 'database_username_here');
 define('DB_PASSWORD', 'database_password_here');
 define('DB_HOST', 'localhost');
 define('DB_CHARSET', 'utf8');
 
 /** The Database Collate type. Do not change this type if you are in doubt. */
 define('DB_COLLATE', '');

When you save the file after saving it, WordPress will then WordPress website will begin pulling data from your new database.

Updated WordPress site
Updated WordPress site

MariaDB and

It is easy for users to get started with MariaDB. It isn't necessary to think about updating your database software and cleaning up the database or looking for mistakes. We will take care of these nitty-gritty tasks to make sure you can concentrate on making quality content for your site users.

Summary

Transferring from MySQL switching to MariaDB is a simple process. It is essential backup your database and remove MySQL before installing MariaDB, and then import the backup of your database.

Be aware that you may run into some problems when transferring between MySQL to MariaDB. As an example, you could get an error if the schema in MySQL doesn't match the schema of MariaDB. Also, ensure you run mysql_upgrade in the process of transferring between versions. The most common answer to problems with migration is to upgrade each database to the most recent versions prior to attempting another time.

As MariaDB continues to innovate and improve its capabilities, it is likely to be more incompatible with MySQL on a rudimentary level. Therefore, if you're already making use of MySQL and are considering moving to MariaDB to reap the benefits, it's best to do it sooner rather than later.