安装官方yum
wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
yum -y install mysql57-community-release-el7-10.noarch.rpm
安装MySQL服务器
yum -y install mysql-community-server
MySQL服务管理
//开启服务
systemctl start mysqld.service
//重启mysql服务
systemctl restart mysqld.service
//查看mysql服务当前状态
systemctl status mysqld.service
//设置mysql服务开机自启动
systemctl enable mysqld.service
//停止mysql服务开机自启动
systemctl disable mysqld.service
//MySQL默认生成随机密码,查看密码
grep "password" /var/log/mysqld.log
//停止mysql服务
systemctl stop mysqld.service
修改密码
set global validate_password_length=6;
set global validate_password_policy=0;
alter user 'root'@'localhost' identified by '123456';
远程连接权限
use mysql;
update user set Host='%' where User='root';
flush privileges;