rpm -qa | grep mariadb #一般centos都安装此MariaDB,如果查询到,需要卸载
yum -y remove mariadb*
cd /home
mkdir mysql
wget http://repo.mysql.com/mysql57-community-release-el7-8.noarch.rpm
rpm -ivh mysql57-community-release-el7-8.noarch.rpm
yum install mysql-server #安装提交一直输入Y
systemctl start mysqld
cat /var/log/mysqld.log | grep password #是一串密码明文
mysql -uroot -p #输入上一步密码
set global validate_password_policy=LOW #设置密码安全级别为低
set global validate_password_length=6 #设置密码长度为6
alter user 'root'@'localhost' identified by '123456'; #修改密码为123456
flush privileges; #刷新权限
exit