Tutorial on Migrating Projects from MYSQL to MARIADB

Tutorial on Migrating Projects from MYSQL to MARIADB

Prepare the database (MySQL). If you already have MySQL, you can ignore this.

build MySQL table;

Connect to MySQL;

mysql -u root -p

Create a data table;

mysql> create database demo;

mysql> use demo;

mysql> create table pet(name varchar(30), owner varchar(30), species varchar(20), sex char(1));

Add data table content;

mysql> insert into pet values('brandon','Jack','puddle','m'),('dixie','Danny','chihuahua','f');

exit(); ---- Exit MySQL

backup MySQL;

Foreword, enable binary;

Back up the data table; back up my.cnf;

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

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



del MySQL;

Stop the MySQL service;

$ sudo service mysql stop //RHEL6

$ sudo systemctl stop mysql //RHEL7

$ sudo /etc/init.d/mysql stop //RHEL6

Remove MySQL configuration and files;

$ sudo yum remove mysql* mysql-server mysql-devel mysql-libs

$ sudo rm -rf /var/lib/mysql

build mariadb;

Install mariadb and related dependency packages;

$ sudo vi /etc/yum.repos.d/MariaDB.repo //創建自定義的yum源

....................................... //The following is the file content

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/5.5/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

.......................................

$ sudo yum install MariaDB-server MariaDB-client//安裝MariaDB

Restore the my.cnf file;

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

Start mariadb;

$ sudo service mariadb start

$ sudo systemctl start mariadb

$ sudo /etc/init.d/mariadb start

MySQL ==>> MARIADB;

Import the data table into mariadb;

$ mysql -u root -p < backupdb.sql

The following content appears, indicating that the login is successful; Congratulations;

$ mysql -u root -p

......................................//The following is the sql command

MariaDB [(none)]> show databases;

MariaDB [(none)]> use test01;

MariaDB [test01]> select * from pet;

You may also be interested in:
  • Restart MariaDB with mysql under Centos7
  • Detailed explanation of MariaDB installation method for basic use of MySQL
  • Issues encountered when migrating from MySQL 5.5 to MariaDB 10.1.14
  • Basic operation tutorial for migrating database from MySQL to MariaDB under Linux
  • A brief discussion on the difference between MySQL and MariaDB
  • MySQL fork selection reference: Percona or MariaDB

<<:  Example code for developing h5 form page based on react hooks and zarm component library configuration

>>:  React+Koa example of implementing file upload

Recommend

Test and solution for MySQL's large memory usage and high CPU usage

After the changes: innodb_buffer_pool_size=576M -...

Detailed explanation of HTML document types

Mine is: <!DOCTYPE html> Blog Garden: <!...

Detailed installation tutorial of mysql 5.7 under CentOS 6 and 7

You always need data for development. As a server...

Solution to MySQL Installer is running in Community mode

Today I found this prompt when I was running and ...

Detailed steps for installing and configuring MySQL 8.0 on CentOS

Preface Here are the steps to install and configu...

MySQL 8.0.22 winx64 installation and configuration method graphic tutorial

The database installation tutorial of MySQL-8.0.2...

Detailed explanation of zabbix executing scripts or instructions on remote hosts

Scenario Requirements 1. We can use the script fu...

Several ways to manually implement HMR in webpack

Table of contents 1. Introduction 2. GitHub 3. Ba...

Apply provide and inject to refresh Vue page method

Table of contents Method 1: Call the function dir...

Implementing a web calculator based on JavaScript

This article shares the specific code of JavaScri...

MySQL data operation-use of DML statements

illustrate DML (Data Manipulation Language) refer...

The difference between Readonly and Disabled

To summarize: Readonly is only valid for input (te...