小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

centos7 Mariadb5.5升級(jí)到Mariadb10.2

 rongq2007 2019-08-13

一次升級(jí)過(guò)程,在此記錄下。

原因:新的項(xiàng)目需要新的數(shù)據(jù)庫(kù)版本支持。

升級(jí)主要步驟:

備份原數(shù)據(jù)庫(kù) ---》卸載mariadb ---》添加mariadb國(guó)內(nèi)yum源 ---》安裝mariadb---》初始化數(shù)據(jù)庫(kù)---》導(dǎo)入數(shù)據(jù)。

1. 備份原數(shù)據(jù)庫(kù)

   由于是對(duì)測(cè)試環(huán)境的數(shù)據(jù)庫(kù)進(jìn)行升級(jí),數(shù)據(jù)量不多,我直接導(dǎo)出需要遷移的數(shù)據(jù)庫(kù)的數(shù)據(jù)到sql文件里。

mysqldump  -uroot  -p  --database database_name >name.sql

2. 卸載mariadb

   由于是在同一臺(tái)服務(wù)器進(jìn)行安裝新的Mariadb10.2,所以我們需要將老的版本卸載。

卸載mariadb:

yum remove mariadb

刪除配置文件:

rm -f /etc/my.cnf

刪除數(shù)據(jù)目錄:

rm -rf /var/lib/mysql/

3. 添加mariadb10.2的國(guó)內(nèi)yum源

之前我添加的是國(guó)外的源,安裝很耗時(shí),所以我找到國(guó)內(nèi)yum,通過(guò)這個(gè)源安裝較快。

vim  /etc/yum.repos.d/Mariadb.repo

添加以下內(nèi)容:

[mariadb]

name = MariaDB

#baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.4/centos7-amd64/

baseurl =https://mirrors.ustc.edu.cn/mariadb/yum/10.3/centos6-x86/

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

gpgcheck=1


清除yum源緩存數(shù)據(jù)

yum clean all

生成新的yum源數(shù)據(jù)緩存

yum makecache all

官方y(tǒng)um源(國(guó)內(nèi)安裝較慢)

1
2
3
4
5
6
7
# MariaDB 10.2 CentOS repository list - created 2018-06-06 03:42 UTC
# http://downloads./mariadb/repositories/
[mariadb]
name = MariaDB
baseurl = http://yum./10.2/centos7-amd64
gpgkey=https://yum./RPM-GPG-KEY-MariaDB
gpgcheck=1

官方不同系統(tǒng)yum源網(wǎng)址:https://downloads./mariadb/repositories/#mirror=tuna

4. 安裝mariadb10.2

yum install MariaDB-server MariaDB-client -y

啟動(dòng)并添加開(kāi)機(jī)自啟:

systemctl start mariadb.service

systemctl enable mariadb.service

systemctl start mariadb  #啟動(dòng)MariaDB

systemctl stop mariadb  #停止MariaDB

systemctl restart mariadb  #重啟MariaDB

systemctl enable mariadb  #設(shè)置開(kāi)機(jī)啟動(dòng)

--------------------

5. mariadb的初始化

對(duì)數(shù)據(jù)庫(kù)進(jìn)行一些基本設(shè)置:
# mysql_secure_installation

/usr/bin/mysql_secure_installation

一般建議按以下進(jìn)行配置:

Enter current password for root (enter for none): Just press the Enter button
Set root password? [Y/n]: YNew password: your-MariaDB-root-passwordRe-enter new password: your-MariaDB-root-passwordRemove anonymous users? [Y/n]: YDisallow root login remotely? [Y/n]: nRemove test database and access to it? [Y/n]: YReload privilege tables now? [Y/n]: Y

6. 導(dǎo)入數(shù)據(jù)到新版本mariadb

方法一:

登陸mysql后用source命令:(后面跟的是我們備份的sql文件的路徑)

source /root/backup/java_api.sql

方法二:

在命令行直接導(dǎo)入

mysql -uroot -p >/root/backup/java_api.sql

以上就是整個(gè)版本升級(jí)的過(guò)程了。

作者:理想三旬

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,所有內(nèi)容均由用戶發(fā)布,不代表本站觀點(diǎn)。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,謹(jǐn)防詐騙。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào)。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類(lèi)似文章 更多