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

Detailed explanation of Mysql's method of optimizing order by statement

In this article, we will learn about the optimiza...

Example of how to build a Mysql cluster with docker

Docker basic instructions: Update Packages yum -y...

React hooks pros and cons

Table of contents Preface advantage: shortcoming:...

Docker installation and configuration image acceleration implementation

Table of contents Docker version Install Docker E...

How to install and configure Redis in CentOS7

Introduction There is no need to introduce Redis ...

Use iframe to display weather effects on web pages

CSS: Copy code The code is as follows: *{margin:0;...

Configure Mysql master-slave service implementation example

Configure Mysql master-slave service implementati...

MySQL infobright installation steps

Table of contents 1. Use the "rpm -ivh insta...

Play mp3 or flash player code on the web page

Copy code The code is as follows: <object id=&...

Detailed steps for deploying Microsoft Sql Server with Docker

Table of contents 1 Background 2 Create a contain...

Three properties of javascript objects

Table of contents 1. writable: writable 2. enumer...

Example code for implementing simple ListViews effect in html

HTML to achieve simple ListViews effect Result: c...

How to install Jenkins on CentOS 8

To install Jenkins on CentOS 8, you need to use t...

Embed codes for several older players

The players we see on the web pages are nothing m...