[英]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: 因此,尝试像这样重置:
Stop the MySQL Server. 停止MySQL服务器。
sudo /etc/init.d/mysql stop
Start the mysql without password 在没有密码的情况下启动mysql
sudo mysqld_safe --skip-grant-tables &
Login to mysql
as root
: 以
root
身份登录到mysql
:
mysql -u root
Set new password to root
将新密码设置为
root
UPDATE mysql.user SET Password=PASSWORD('password') WHERE User='root';
Flush privileges. 刷新权限。
FLUSH PRIVILEGES;
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.