mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES)
来源:互联网 发布:怎么做淘宝网页 编辑:程序博客网 时间:2024/06/06 01:50
mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'zzq'@'localhost' (using password: YES)
mysql中有新建了一个%(允许所有主机连接)和ALL权限的账户。但是竟然连不上。用root或者其他localhost的用户却可以登录。首先检查下防火墙打开了没,可以用service iptables stop打开防火墙。如果仍然报错:
报错:ERROR 1045 (28000): Access denied for user 'zzq'@'localhost' (using password: YES)
帐号密码都对了 就是连不上。细心的话我们会发现 帐号权限是%,而这里提示的是localhost。
错误原因如下:
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'localhost' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%' IDENTIFIED BY 'some_pass' WITH GRANT OPTION;
?6?1 前两个帐户名称都是monty,而且都是拥有所有权限和密码。但是两者的区别在于,第一个帐户(monty@localhost)只能通过本地登录,而第二个账户(monty@%)可以通过任意主机登录。值得注意的是,为了能够使用monty帐户在任何地方进行登录,这两个账户同时存在则是必要的。因为,如果没有本地帐户(monty@localhost),使用monty帐户登录时,mysql_install_db将优先考虑创建一个本地的匿名帐户。那么结果将是monty账户会被当作一个匿名帐户来处理。原因则在于,匿名帐户拥有一个比nonty@%账户更加具体的host字段值,从而在user表排序的时候会相对出现的更早。
也就是说 同一个账户 要同时存在%帐号或者localhost帐号时, %帐号才起作用。
我们给 zzq帐号添加一个localhost帐号。
GRANT ALL PRIVILEGES ON *.* TO 'zzq'@'localhost' IDENTIFIED BY '123456' WITH GRANT OPTION;
flush privileges;
然后再登录 发现可以登录了。 远程用workbench也能连接了。
这仅仅是访问权限不够
ERROR 1045 (28000): Access denied for user 'xcj'@'localhost' (using password: YES)
#新加用户服务xcj,新加的用户不能马上生效
mysql> grant all on *.* to xcj@'%' identified by "xcj_passwd";
Query OK, 0 rows affected (0.04 sec)
#生效新加用户xcj权限
mysql> flush privileges;
Query OK, 0 rows affected (0.03 sec)
[root@openfire pdf_spider]# mysql -uxcj -p'xcj_passwd'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 4593
Server version: 5.0.45-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
#若是还不生效,就见鬼了
- mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES)
- mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'zzq'@'localhost' (using password: YES)
- mysql登录出现:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- MySQL登录出现ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- MySQl登录错误:ERROR 1045: Access denied for user: 'root@localhost' (Using password: YES)
- Mysql登录提示1045 error:access denied for user 'root'@'localhost <using password: yes>
- mysql 以某用户登录错误 ERROR 1045 (28000): Access denied for user 'bill'@'localhost' (using password: YES)
- mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 解决办法
- mysql报错:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- mysql ERROR 1045 (28000): Access denied for user 'zyl'@'localhost' (using password: YES)
- mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- mysql 错误解决 ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
- mysql出现:ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) 错误
- 【MySql】ERROR 1045 (28000): Access denied for user 'ambari'@'localhost' (using password: YES)
- MySql 出现ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES).问题解决方案
- Fresco源代码分析
- C/C++——求下面数据类型的最大值和最小值: char, short, int, long, float, double, long double和numeric_limits使用
- Android开发优化之——对界面UI的优化(1)
- PostgreSQL数据字典查询[持续更新]
- html5 ajax文件上传
- mysql全局权限账户%登录不上ERROR 1045 (28000): Access denied for user 'mhz'@'localhost' (using password: YES)
- linux下tomcat开启远程调试
- LinuxMint17.3Rosa下安装Apache流程
- android、webview、js交互
- android-studio快捷键(md格式)
- oracle 两种认证方式总结
- linux设备驱动归纳总结(三):1字符型设备之设备申请
- SQL Server日期计算(使用DATEADD和DATEDIFF函数)
- block