注意,如果有数据记得先备份
mysqldump -uroot -p db > /data/backup/db.sql
yum remove mariadb # 删除mariadb
yum remove mysql # 删除mysql
安装
wget http://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
yum -y install mysql57-community-release-el7-11.noarch.rpm
yum install mysql-server --nogpgcheck
设置启动项
systemctl start mysqld # 启动
systemctl enable mysqld # 开机自启
systemctl status mysqld # 查看状态
首次登录修改密码,图中箭头指的为默认密码
cat /var/log/mysqld.log| grep password
mysql -p
ALTER USER USER() IDENTIFIED BY 'Admin12300.';
恢复数据
source /data/backup/db.sql
原创文章,作者:admin,如若转载,请注明出处:https://ntib.cn/438.html