为什么我的密码在mysql中不起作用?苹果电脑

时间:2019-03-17 12:49:09

标签: mysql macos homebrew

我已经通过Homebrew安装了MySQL(8.0.15),并使用以下步骤设置了root密码these steps之后,将密码设置为root,但是当我尝试

我明白了: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

我尝试通过安全模式重置它,但仍然无法正常工作。我尝试检查authentication_string及其它

mysql> select authentication_string from user where User = 'root';
+-----------------------+
| authentication_string |
+-----------------------+
| root                  |
+-----------------------+
1 row in set (0.00 sec)

1 个答案:

答案 0 :(得分:0)

我猜测命令{"@timestamp":"2019-03-14T04:54:18.487-04:00","@version":1,"message":"input -> \n {\r\n \"userId\" : \"RegUser-58\",\r\n \"contactCode\" : \"123456\",\r\n \"IsSupervisor\" : \"N\",\r\n \"AllowToSubmitOrders\" : \"Y\",\r\n \"SuspendAccess\" : \"N\",\r\n \"CustNo\" : \"123456\",\r\n \"userEmail\" : \"test.user@testserver.com\",\r\n \"isNewUser\" : \"Y\"\r\n}","logger_name":"com.test.UserService","thread_name":"http-nio-8080-exec-2","level":"INFO","level_value":20000,"X-Span-Export":"false","X-B3-SpanId":"X-B3-SpanId","PRINCIPAL":"TestUser","X-B3-TraceId":"X-B3-SpanId","SOURCEIP":"0:0:0:0:0:0:0:1"} 不会照原样设置密码,而是对其进行哈希处理。您确定您不会错过来自的密码命令吗? PASSWORD 尝试使用UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';,它应该带给您哈希值而不是字符串。 由于您的数据库本身具有“ STRING”而不是散列值,因此可能是问题所在。