項(xiàng)目從MYSQL遷移至MARIADB教程
準(zhǔn)備數(shù)據(jù)庫(MySQL),若已有MySQL,可忽略.
build MySQL table;
連接MySQL;
mysql -u root -p
創(chuàng)建數(shù)據(jù)表;
mysql> create database demo; mysql> use demo; mysql> create table pet(name varchar(30), owner varchar(30), species varchar(20), sex char(1));
添加數(shù)據(jù)表內(nèi)容;
mysql> insert into pet values('brandon','Jack','puddle','m'),('dixie','Danny','chihuahua','f');
exit(); ----退出MySQL
backup MySQL;
前情提示,啟用二進(jìn)制;
備份數(shù)據(jù)表;備份my.cnf;
$ mysqldump --all-databases --user=root --password --master-data > backupdb.sql $ sudo cp /etc/mysql/my.cnf /opt/my.cnf.bak
del MySQL;
停止MySQL服務(wù);
$ sudo service mysql stop //RHEL6 $ sudo systemctl stop mysql //RHEL7 $ sudo /etc/init.d/mysql stop //RHEL6
移除MySQL配置及文件;
$ sudo yum remove mysql* mysql-server mysql-devel mysql-libs $ sudo rm -rf /var/lib/mysql
build mariadb;
安裝 mariadb;以及相關(guān)依賴包;
$ sudo vi /etc/yum.repos.d/MariaDB.repo //創(chuàng)建自定義的yum源
....................................... //以下為文件內(nèi)容
[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
恢復(fù)my.cnf文件;
$ sudo cp /opt/my.cnf /etc/mysql/
啟動(dòng)mariadb;
$ sudo service mariadb start $ sudo systemctl start mariadb $ sudo /etc/init.d/mariadb start
MySQL ==>> MARIADB;
將數(shù)據(jù)表導(dǎo)入到mariadb中;
$ mysql -u root -p < backupdb.sql
出現(xiàn)一下內(nèi)容,表示登錄成功;恭喜你;
$ mysql -u root -p
......................................//以下為sql命令
MariaDB [(none)]> show databases; MariaDB [(none)]> use test01; MariaDB [test01]> select * from pet;
相關(guān)文章
將mysql腳本轉(zhuǎn)化為oracle腳本的攻略與細(xì)節(jié)點(diǎn)
前段時(shí)間公司項(xiàng)目數(shù)據(jù)庫需要從mysql轉(zhuǎn)為oracle,所以需要修改下原有的mysql腳本,這篇文章主要給大家介紹了關(guān)于將mysql腳本轉(zhuǎn)化為oracle腳本的攻略與細(xì)節(jié)點(diǎn),需要的朋友可以參考下2023-09-09

