检查系统是否装有mariadb
rpm -qa | grep mariadb
卸载mariadb
强制卸载mariadb
rpm -e --nodeps mariadb-libs-5.5.35-3.el7.x86_64
安装mysql
rpm -ivh mysql-community-common-5.7.12-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-5.7.12-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-5.7.12-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.12-1.el7.x86_64.rpm
其中在安装 mysql-community-server-5.7.12-1.el7.x86_64.rpm 时可能会因为系统没有相应依赖文件而安装失败,如下
安装perl:
yum install perl
yum install libaio
安装完毕后启动mysql:
service mysqld start
查看初始密码:
grep 'temporary password' /var/log/mysqld.log
用初始密码登录
mysql -uroot -p
登陆后修改密码:
ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass4!';
参考:
http://www.jb51.net/LINUXjishu/401516.html
http://dev.mysql.com/doc/refman/5.7/en/linux-installation-rpm.html