mariadb升级成mysql5.7

1.Mariadb停止及备份数据
Systemctl stop mariadb
cp -r /var/lib/mysql /mnt/mysql (如果有数据,要备份下,然后拷到mysql;如果没数据,可以不用备份)
cp -r /etc/my.cnf /mnt

2.libmysqlclient.so.18.0.0重建
cp /usr/lib64/mysql/libmysqlclient.so.18.0.0 /usr/lib64/
ln -s /usr/lib64/libmysqlclient.so.18.0.0 /usr/lib64/libmysqlclient.so.18

3.卸载mariadb组件
rpm -e mariadb-server mariadb mariadb-devel mariadb-libs --nodeps

4.安装mysql4.7
rpm -Uvh mysql-community-client-5.7.22-1.el7.x86_64.rpm mysql-community-common-5.7.22-1.el7.x86_64.rpm mysql-community-libs-5.7.22-1.el7.x86_64.rpm mysql-community-server-5.7.22-1.el7.x86_64.rpm --force

5.拷贝数据
systemctl enable mysqld

\cp -r /mnt/mysql/* /var/lib/mysql/
chown -R mysql:mysql /var/lib/mysql
\cp /mnt/my.cnf /etc

systemctl start mysqld

6.mysql设置密码强度low
如果有些sql不符合密码强度,可以临时设置下mysql密码强度为low
mysql -u root -p$SQL_PASSWORD -e “set global validate_password_policy=‘low’;”

你可能感兴趣的:(mariadb升级成mysql5.7)