从MariaDB 5.x升级到10.x
在CentOS7.x上升级MariaDB 5.x到10.X:
备份:
# mysqldump -u root -p –all-databases > alldb.sql
# cp /etc/my.cnf /etc/my.cnf.bak.20240126
停止:
# systemctl stop mariadb
# yum remove mariadb mariadb-server
添加MariaDB官方源:
# vi /etc/yum.repos.d/MariaDB.repo
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.11.6/centos74-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
安装新版本:
# yum clean all
# yum makecache
# yum install mariadb mariadb-server
# vi /etc/my.cnf
注释掉所有以innodb开头的配置项,因为引擎换成了XtraDB,不再支持innodb了。
启动新版本:
# mkdir /var/lib/mysql
# chmod 777 /var/lib/mysql
# systemctl start mariadb
# systemctl status mariadb.service
# systemctl enable mariadb
升级数据库表:
# mysql_upgrade -uroot -p
登入查看数据:
# mysql -uroot -p