简体   繁体   English

错误1045(28000):用户'root'@'%'的访问被拒绝

[英]ERROR 1045 (28000): Access denied for user 'root'@'%'

I am trying to run 我正在尝试跑步

GRANT ALL PRIVILEGES ON * . * TO 'root'@'localhost';

from a remote server to localhost/phpmyadmin but getting ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: NO). 从远程服务器到localhost / phpmyadmin,但收到错误1045(28000): Access denied for user 'root'@'%' (using password: NO).

mysql> show grants;
+----------------------------------+
| Grants for root@%                |
+----------------------------------+
| GRANT USAGE ON *.* TO 'root'@'%' |
+----------------------------------+

How can I resolve this problem? 我该如何解决这个问题? I have gone through a lot of suggestions over internet but can't actually figure out. 我已经通过互联网提出了很多建议,但实际上无法弄清楚。

I think, you forgot to flush privileges . 我认为,您忘记了flush privileges

mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' with GRANT OPTION;
mysql> FLUSH PRIVILEGES;

Note: I have included with GRANT OPTION because as doc says: 注意:我已将with GRANT OPTION包含在内with GRANT OPTION因为如文档所述:

The GRANT OPTION privilege enables you to give to other users or remove from other users those privileges that you yourself possess. 使用GRANT OPTION特权,您可以授予其他用户或从其他用户中删除您自己拥有的那些特权。

Edit 1: 编辑1:

Depending on comments, seems like you have forgotten the root password. 根据评论,好像您忘记了root密码。 So try to reset like this: 因此,尝试像这样重置:

  1. Stop the MySQL Server. 停止MySQL服务器。

    sudo /etc/init.d/mysql stop

  2. Start the mysql without password 在没有密码的情况下启动mysql

    sudo mysqld_safe --skip-grant-tables &

  3. Login to mysql as root : root身份登录到mysql

    mysql -u root

  4. Set new password to root 将新密码设置为root

    UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';

  5. Flush privileges. 刷新权限。

    FLUSH PRIVILEGES;

  6. Finally, restart mysql normally. 最后,正常重启mysql。

If you have root credential , then Set the privileges like mentioned below. 如果您具有root凭据,则按如下所述设置权限。

grant all privileges on db.* to user@'%' identified by 'pass'; 将db。*上的所有特权授予“ pass”标识的user @'%';

Thanks 谢谢

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MySQL 错误 1045 (28000):用户“root”@“localhost”的访问被拒绝 - MySQL ERROR 1045 (28000): Access denied for user 'root'@'localhost' Mac mysql错误1045(28000):用户'root'@'localhost'的访问被拒绝 - Mac mysql ERROR 1045 (28000): Access denied for user 'root'@'localhost' 错误1045(28000):用户'= root'@'localhost'的访问被拒绝(使用密码:否) - ERROR 1045 (28000): Access denied for user '=root'@'localhost' (using password: NO) 错误 1045 (28000): 拒绝用户 'root'@'localhost' 的访问 - ERROR 1045 (28000): Access denied for user 'root'@'localhost' ERROR 1045(28000):用户'root'@'localhost'拒绝访问(使用密码:NO) - ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) MYSQL错误:1045(28000):用户'root'@'localhost'拒绝访问 - MYSQL error: 1045 (28000): Access denied for user 'root'@'localhost' SQLSTATE [28000] [1045]用户'root'@ host的访问被拒绝 - SQLSTATE[28000] [1045] Access denied for user 'root’@host 错误1045(28000):访问被拒绝 - ERROR 1045 (28000): Access denied 无法访问 MySQL:错误 1045 (28000):用户 'root'@'localhost' 的访问被拒绝(使用密码:是) - Cannot access 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: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM