mysql“Access denied for user 'root'@'IP地址

来源:互联网 发布:python经典书籍推荐 编辑:程序博客网 时间:2024/06/07 08:12


mysql“Access denied for user 'root'@'IP地址'

 1308人阅读 评论(0) 收藏 举报
 分类:

    xshell连接MySQL毫无问题,使用toad登录时提示“Access denied for user 'root'@'10.1.6.130' (using password: YES)”,搜到以下解决办法http://www.cnblogs.com/wonder315/archive/2011/11/02/2233010.html

    遂考虑使用

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. grant all privileges on *.* to 'root'@'%' with grant option;  

    出于安全性考虑,不能采用所有的ip都放通,于是使用自己ip,同时限制死数据库

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. grant all privileges on calshard.* to 'root'@'10.1.6.130'  with grant option;  

    实际上,后方的with grat option,应该根据实际情况填写,使用show grants看到的倒是的确会有这个后缀,直接执行会有如下错误:

ERROR 1133 (42000): Can't find any matching row in the user table

   改为

[html] view plain copy
 在CODE上查看代码片派生到我的代码片
  1. grant all privileges on calshard.* to 'root'@'10.1.6.130'  identified by 'xxx';  

   搞定


这个也挺全的

 http://www.cnblogs.com/beanmoon/p/3173924.html


UPDATE user SET Password=PASSWORD('123456') where USER='root';




mysql> GRANT ALL ON *.* TO 'root'@'localhost';


mysql> GRANT ALL ON *.* TO 'root'@'cn.cn.cn.cn';

mysql> GRANT ALL ON *.* TO 'root'@'245.245.245.245';

mysql> GRANT ALL ON *.* TO 'root'@'127.0.0.1';

mysql> FLUSH PRIVILEGES
0 0
原创粉丝点击