且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

用户'root'@'localhost'拒绝访问(使用密码:YES)

更新时间:2023-12-01 21:14:52

由于第一个指定的代码工作并且也基于报告的跟踪,我很确定问题出在数据库上,而不是代码语法。

Since the first specified code works and also based on the reported trace, i'm pretty sure the problem is on the database, not the code syntax.

根据Mysql版本,请尝试替代设置权限,而不指定基于 Mysql文档

Based on the Mysql version, please try as an alternative to set privileges without specifying the any host (%) as based on Mysql documentation,


简单形式user_name是user_name @'%'的同义词

The simple form user_name is a synonym for user_name@'%'

使用 FLUSH PRIVILEGES后立即刷新权限;

为了确保一切正确,还要运行
为NewUser显示资金; 并检查NewUser是否出现在具有相应权限的列表中。

Just to make sure everything is correct, also run a SHOW GRANTS FOR NewUser; and check if NewUser appears in the list with the corresponding permissions.