Simple steps for migrating from MySQL to MariaDB on Linux

Source: Internet
Author: User
Tags mysql command line

Hello everyone! This is a tutorial on how to migrate from MySQL to mariadb on a server or PC. Perhaps you ask why we are migrating database management from MySQL to mariadb. Look down we'll tell you why.
Why use MARIADB instead of MYSQLMARIADB is a branch of MySQL community development and an enhanced alternative. It was developed by a foundation that was spearheaded by MySQL's former developers and used exactly the same as MySQL. Since Oracle bought MySQL, it's no longer free to open source, but MARIADB is still free to open source. Some of the top sites, such as Google, wiki, LinkedIn, and Mozilla, have migrated to MARIADB. Where is the advantage of it:

Backwards compatible with MySQL
Always open source
Maintenance by the MySQL creator
More cutting-edge features
More storage engines
Large websites have turned to mariadb now, let's move to MARIADB!

Let's create a sample database called Linoxidedb for testing.
Log in to MySQL with the root account using the following command:
$ mysql-u Root-p After you enter the root user password for MySQL, you will enter the MySQL command line
To create a test database:
Enter the following command on the MySQL command line to create the test database.
mysql> CREATE database Linoxidedb; View the available databases, enter the following command:
mysql> show databases;
As you can see, we have a total of 5 databases in the newly built linoxidedb.
Mysql> quit now, let's move the database we just created from MySQL to mariadb.
Note: It is not necessary to refer to this tutorial for Fedora-based Linux distributions using CentOS, as they will automatically replace MySQL when installing mariadb, without having to back up the existing database, and you will only need to update MySQL to get mariadb.
1. Backing up an existing database our first important step is to back up the existing database. We complete the backup in the terminal (not the MySQL command line) by entering the following command.
$ mysqldump--all-databases--user=root--password--master-data > Backupdatabase.sql wow Oh! We're having a little trouble. Don't worry, we can handle it.
$ mysqldump:Error:Binlogging on server not active
Mysqldump Error
To fix this error, we need to make some minor changes to the My.cnf file.
Edit My.cnf File:
$ sudo nano/etc/mysql/my.cnf Add the following parameters in the [mysqld] section.
Log-bin=mysql-bin

Well, after saving and closing the file, we need to restart the MySQL service. Run the following command to restart:
$ sudo/etc/init.d/mysql Restart Now, rerun the mysqldump command to back up all the databases.
$ mysqldump--all-databases--user=root--password--master-data > Backupdatabase.sql
Dumping databases
The above command will back up all the databases and store them in the Backupdatabase.sql file in the current directory.
2. Uninstalling MySQL First, we have to move the my.cnf file to a safe place.
Note: The my.cnf file is not automatically deleted when you uninstall the MySQL package, we do this just in case. When the MARIADB is installed, it asks whether we are keeping the existing MY.CNF file or using the version that comes with the package (that is, the new my.cnf file).
Back up the my.cnf file by entering the following command in the shell or terminal:
$ sudo cp/etc/mysql/my.cnf my.cnf.bak run the command to terminate the MySQL service:
$ sudo/etc/init.d/mysql Stop and then remove the MySQL package:
$ sudo apt-get remove mysql-server mysql-client
(↓↓--not finished--↓↓)

Perfect reading and spitting, please hit: http://linux.cn/article-5176-qqmail.html[258,3,1427932080]

Simple steps for migrating from MySQL to MariaDB on Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.