且构网

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

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

更新时间:2022-04-28 04:13:22

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

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版本,请尝试基于

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.