mysql 登录提示 “is not allowed to connect to this mysql server”

解决方法一

  1. 执行 mysql -u root -p 然后输入密码登陆mysql

  2. GRANT ALL PRIVILEGES ON . TO ‘myuser’@’%’ IDENTIFIED BY ‘mypassword’ WITH GRANT OPTION;

  3. 执行:FLUSH PRIVILEGES;

  4. 此时可以使用myuser用户,mypassword密码远程登陆mysql服务器了

解决方法二

  1. 执行 mysql -u root -p,然后输入密码登陆mysql

  2. use mysql;

  3. select host from user where user= 'root';查看当前mysql允许登录的地址

  4. update user set host='%' where user = 'root';

  5. flush privileges;

以上两种方式都可以使用

posted @ 2022-04-11 16:39  dcrenl  阅读(274)  评论(0)    收藏  举报