How to Convert MariaDB to MYSQL?

MariaDB is a relational database management system RDBMS and is a fork of MySQL. Though MariaDB is considered as a drop-in replacement for MySQL, it has diverged significantly. Several organizations migrate from MariaDB to MySQL because of support contracts and licensing terms. In this article, we'll see how to move or convert data from MariaDB to MySQL.

Methods to Convert or Migrate MariaDB to MySQL

 If you want to migrate from MariaDB to MySQL, you need to move data by reading it from MariaDB and writing it in MySQL. This operation can be executed manually or using a dedicated database converter tool. Below, we will discuss both ways.

Migrate MariaDB to MySQL Manually

 To migrate from MariaDB to MySQL manually, follow the below steps:

  • Perform Compatibility Test

A crucial step before proceeding is to look for incompatibility. In MariaDB, there are functions that are not available in MySQL. For example - the Data Types. MariaDB supports INET6, while this data type is not present in MySQL 8.0. It may also happen that a function may differ in name.

  • Dumping Data Out of MariaDB

To dump data out of MariaDB, you can use the Dump loading utility. You can execute the following mysqldump command:

mysqldump -u user_name -p db_name > dumped_data.sql

Here, -u is the username and -p is the name of the MariaDB database.

This command creates the file dumped_data.sql that contains the data of the MariaDB database.

  • Install MySQL 8.0

Install the MySQL version 8.0, if you don't have already.

  • Create a New MySQL Database

Using the MySQL shell or the MySQL workbench (the official GUI of MySQL), create a new database. Use the following SQL command:

Create database /destination_database /destination_database

In the /destination_database, enter the name of the database you want create./destination_database

  • Import Data into MySQL 8.0

To import the data into MySQL database, you can use the MySQL Shell. Execute the following SQL command:

       mysqldump -u user_name -p db_name < dumped_data.sql

Here, -u is the username and -p is the name of the new MySQL database.

       The db_name is filled with data from dumped_data.

Migrate MariaDB to MySQL using Database Converter Tool

 You can use a specialized database converter tool, such as Stellar Converter for Database to make the migration process easy, quick, and safe.

 Download, install, and launch the tool. When the tool starts, it asks for a source database to convert.

Selecting a source to connect

Select the format of the source database.

Click 'Browse' to select the database you want to convert.

Browsing The Database To Convert

To perform an offline migration, you need to specify the path of the MariaDB data file.

To perform a live migration, you must connect to the database instance using an ODBC driver and specify the username and password.

Here, we will select the offline option.

Now, enter the path and press the Scan button.

 

Entering Path and Scanning

When the Scan process is complete, press the OK button.

 

After Scan Click OK

On the left side of the interface, the list of the databases is shown.

 

List of Databases Added

Press the Convert button.

 

Click Convert Button

You cannot save data directly in MySQL format. You can make an intermediate step and save it in a different format. For example, MS Access.

 

Browse and Enter Path

Press the Browse button and enter a path.

 

Convert and Save Database

At the end of the process, the data is saved in Access format.

 

Data Saved in Access Format

Now, you can repeat the procedure to migrate data from Access to MySQL.

Press the Select Database button and choose the MS Access format.

 

Choosing MS Access from Databases

Press the Browse button and select the Access (.mdb) file just created.

Browsing and Select Access

 

Adding Browse Button

Press the Scan button.

 

Scanning Press Button

When the Scanning process is completed, press the OK button.

 

After Scanning Process Click Ok

Press the Convert button.

 

Pressing Convert Button

Choose MySQL as database type and enter the username, host name, and password.

 

Choosing MYSQL as database type

Press the Save button.

When the process ends, press the OK button.

 

Ending Process Click Ok

To Conclude

Migrating data from one database type to another is never an easy process. The process needs to be planned carefully. Different database types, even if related, such as MariaDB and MySQL may have different data types. Above, we have seen how to migrate data manually using SQL commands and SQL tools. We have also seen how to migrate or convert MariaDB to MySQL using dedicated software, such as Stellar Converter for Database.



Was this article helpful?
About The Author
author image
Bharat Bhushan linkdin Icon

Technical Marketer at Stellar Information Technology Private Limited. He makes Tech concepts easy to understand with his strong grip on Technology.

Table of Contents

WHY STELLAR® IS GLOBAL LEADER

Why Choose Stellar?
  • 0M+

    Customers

  • 0+

    Years of Excellence

  • 0+

    R&D Engineers

  • 0+

    Countries

  • 0+

    PARTNERS

  • 0+

    Awards Received