Mysql 5.5升級5.8


前言,因為升級跳板機,需要將mariadb 升級到10.2,也就是對應MySQL的5.8,廢話不多說下面開始進行mariadb 5.5 的升級

 

Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9580
Server version: 5.5.60-MariaDB MariaDB Server

現在的版本為5.5.60

 

升級主要步驟:

備份原數據庫 ---》卸載mariadb ---》添加mariadb國內yum源 ---》安裝mariadb---》初始化數據庫---》導入數據。

1、備份所有數據

mysqldump -u root -p  -d --all-databases > /back/MysqlAll.sql

#當然這里也可以根據自己需求進行備份某個庫或者表

2、卸載mariadb

yum remove mariadb

刪除配置文件

rm -rf /etc/my.cnf

刪除數據目錄

rm -rf /var/lib/mysql/

3、添加mariadb 10.2國內yum源

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

添加以下內容

[mariadb]
name = MariaDB
baseurl = https://mirrors.ustc.edu.cn/mariadb/yum/10.2/centos7-amd64
gpgkey=https://mirrors.ustc.edu.cn/mariadb/yum/RPM-GPG-KEY-MariaDB
gpgcheck=1

清楚yum源緩存數據

yum clean all

生成新的yum源緩存數據

yum makecache all

安裝 mariadb10.2

yum install MariaDB-server MariaDB-client -y

啟動並添加開機自啟:

systemctl start mariadb.service
systemctl enable mariadb.service

mariadb初始化設置

/usr/bin/mysql_secure_installation

4、導入數據到新版本的mariadb

mysql -u root -p </back/MysqlAll.sql

到此為止新版本更新完成,切記注意備份數據!!!!


Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 9
Server version: 10.2.18-MariaDB MariaDB Server

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM