安装官方yum

  1. wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm
  2. yum -y install mysql57-community-release-el7-10.noarch.rpm

安装MySQL服务器

  1. yum -y install mysql-community-server

MySQL服务管理

  1. //开启服务
  2. systemctl start mysqld.service
  3. //重启mysql服务
  4. systemctl restart mysqld.service
  5. //查看mysql服务当前状态
  6. systemctl status mysqld.service
  7. //设置mysql服务开机自启动
  8. systemctl enable mysqld.service
  9. //停止mysql服务开机自启动
  10. systemctl disable mysqld.service
  11. //MySQL默认生成随机密码,查看密码
  12. grep "password" /var/log/mysqld.log
  13. //停止mysql服务
  14. systemctl stop mysqld.service

修改密码

  1. set global validate_password_length=6;
  2. set global validate_password_policy=0;
  3. alter user 'root'@'localhost' identified by '123456';

远程连接权限

  1. use mysql;
  2. update user set Host='%' where User='root';
  3. flush privileges;