GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'; ERROR 1045 (28000): Access denied for user 'root'@'%' (using password: YES)
时间: 2023-09-07 16:13:21 浏览: 168
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服务器。引用提到了一个可能的解决方法,即使用命令"mysql> use mysql;"切换到mysql数据库,然后再尝试授权操作。引用展示了一个授予root用户显示所有数据库权限的示例命令。根据错误提示"ERROR 1045 (28000): Access denied for user 'root'@'%'",可能是由于root用户在连接时的访问限制导致的。您可以尝试使用更具体的主机名或IP地址,而不是使用"%"(通配符)来指定允许访问的主机。例如,可以尝试使用命令"GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY 'your_password' WITH GRANT OPTION;"来授予root用户在本地主机上的所有权限。
<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *3* [mysql grant all on *.* to xxx@'%' 报Access denied for user 'root'@'localhost'](https://blog.csdn.net/weixin_30284125/article/details/113262785)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
- *2* [mysql-8.0.20-macos10.15-x86_64.tar.gz](https://download.csdn.net/download/long4512524/12427861)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文