yum remove mariadb-libs-5.5.44-2.el7.centos.x86_64
2.下载mysql的repo源.
mkdir /mysql
cd /mysql
wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
ls 看一下多出一个mysql-community-release-el7-5.noarch.rpm
rpm -ivh mysql-community-release-el7-5.noarch.rpm 安装
装完之后会多两个东西,分别是:
/etc/yum.repos.d/mysql-community.repo
/etc/yum.repos.d/mysql-community-source.repo
3.安装mysql
yum install mysql-server
4.把/var/lib/mysql的拥有者改为当前用户
chown -R user:usergroup /var/lib/mysql
重启
/bin/systemctl restart mysqld.service
5.重置root密码
mysql -u root
use mysql;
update user set password=password('XXXX') where user='root';
6.如果开了防火墙把3306端口开放.