1. 新安装好的数据库查看初始密码

    grep 'temporary password' /var/log/mysqld.log 
    
  2. 修改密码

    -- mysql8.0版本
    ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY "123456";
    
    -- mysql8.0以下版本
    ALTER USER root@localhost IDENTIFIED BY 'admin456rrr';
    
  3. 开放远程访问权限

-- mysql8.0版本
CREATE USER 'testuser'@'%' IDENTIFIED BY 'testpwd';  -- 创建用户
GRANT ALL ON *.* TO 'testuser'@'%' WITH GRANT OPTION;  -- 授权
flush privileges; -- 刷新权限

-- mysql8.0以下版本
grant all privileges  on *.* to root@'%' identified by "password";
 flush privileges;

相关文章:

  • 2021-06-25
  • 2021-06-19
  • 2021-12-04
  • 2021-05-17
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-06-29
  • 2021-12-16
相关资源
相似解决方案