How to migrate MySQL to MariaDB on Linux?
This article will help you migrate your database from MySQL to MariaDB because MySQL to MariaDB binary compatibility is very simple during the migration process.
After Oracle acquired MySQL, the community drove the results of such a movement and developed a new database called MariaDB. MariaDB is open source and compatible with MySQL. Most Linux distributions (RH, CentOS, Fedora) have started using MariaDB support as a drop-in replacement for MySQL.
If we want to migrate the database from MySQL to MariaDB, then this article will be helpful.
Preparing the MySQL database and tables
We create a test MySQL database and overall tables for demonstration purposes. If you have a database and tables in your environment, you can skip this step.
Log in to MySQL from the terminal using the MySQL root user and root user password.
1 |
|
Create a database and tables
1 2 3 4 |
|
In addition, we will add some records to test the data
1 2 3 4 |
|
Backup of MySQL database
We need to use the command – MySQL dump to back up the MySQL database
1 |
|
For security reasons, we will obtain some configuration files of MySQL elsewhere in the system
1 |
|
Uninstall the MySQL package
us MySQL will be uninstalled using the following command –
1 2 |
|
Install MariaDB package
MariaDB has been replaced by MySQL on all major Linux distribution official repositories. You can add the official repository even if you are using an older version of Linux.
Create the file in the yum repos directory
1 |
|
Add the following content to the file and save it
1 2 3 4 5 |
|
To install the Maria-DB server and client, run the following commands .
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
|
After installing all the required packages, we need to set a password for the root user account. Root password recovery from MySQL backup configuration files.
1 |
|
Now, we need to run the following command to restart the MariaDB service.
1 |
|
Import MySQL database
We must import the database we backed up from MySQL into MariaDB
1 |
|
Enter the password of the root user, and then the database will be imported to MariaDB
We need to check whether the database is restored correctly.
Please follow the following command –
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
|
Now the migration from MySQL to MariaDB has been successfully completed.
After we run the command and follow the tutorial, we can migrate the database from MySQL to MariaDB in simple steps, where MariaDB has a lot of new features compared to MySQL. In the tutorial above I used a simple scenario to test the migration configuration.
The above is the detailed content of How to migrate MySQL to MariaDB on Linux?. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics



The article discusses using MySQL's ALTER TABLE statement to modify tables, including adding/dropping columns, renaming tables/columns, and changing column data types.

Article discusses configuring SSL/TLS encryption for MySQL, including certificate generation and verification. Main issue is using self-signed certificates' security implications.[Character count: 159]

Article discusses strategies for handling large datasets in MySQL, including partitioning, sharding, indexing, and query optimization.

Article discusses popular MySQL GUI tools like MySQL Workbench and phpMyAdmin, comparing their features and suitability for beginners and advanced users.[159 characters]

The article discusses dropping tables in MySQL using the DROP TABLE statement, emphasizing precautions and risks. It highlights that the action is irreversible without backups, detailing recovery methods and potential production environment hazards.

The article discusses creating indexes on JSON columns in various databases like PostgreSQL, MySQL, and MongoDB to enhance query performance. It explains the syntax and benefits of indexing specific JSON paths, and lists supported database systems.

Article discusses using foreign keys to represent relationships in databases, focusing on best practices, data integrity, and common pitfalls to avoid.

Article discusses securing MySQL against SQL injection and brute-force attacks using prepared statements, input validation, and strong password policies.(159 characters)
