1. 配置yum源:
    yum -y localinstall  http://file.job520.net/linux/yum-repository/mysql.repo.rpm
    yum repolist enabled | grep "mysql.*-community.*"
    # https://dev.mysql.com/downloads/repo/yum/
  2. 安装:
    yum -y install mysql-community-server
    yum -y install mysql-community-devel
  3. 设置免密登录:
    vim /etc/my.cnf
    [mysqld]
    skip-grant-tables
  4. 启动服务:
    systemctl start mysqld
  5. 登录:
    mysql
  6. 修改密码:
    update mysql.user set authentication_string=password("123456") where user="root";
  7. 退出:
    quit
  8. 删除配置文件:
    rm -f /etc/my.cnf
  9. 重启:
    systemctl restart mysqld
  10. 输入密码登录:
    mysql -uroot -p123456
  11. 修改密码:
    set global validate_password_policy=0;
    set global validate_password_mixed_case_count=0;
    set global validate_password_number_count=3;
    set global validate_password_special_char_count=0;
    set global validate_password_length=3;
    Alter USER 'root'@'localhost' IDENTIFIED BY '123456';
  12. 添加远程访问用户:
    grant all on *.* to 'root'@'%' identified by '123456';
  13. 设置添加用户的授权权限:
    update mysql.user set Grant_priv='Y' where Host='%';
  14. 移除匿名用户:
    delete from mysql.user where Host<>'%' or User<>'root';
文档更新时间: 2020-08-08 20:40   作者:lee