一尘不染

自动生成临时密码后无法访问MySQL

mysql

我已擦除并安装了该软件OSX 10.11 El Capitan,并已按照本教程进行操作MySQL,以在新的OS
X上启动并运行。第一步是下载MySQL for Mac OS X 10.9(x86,64位),DMG
Archive
(在10.11上运行)。
,他们在本教程中建议)。当我完成安装MySQL时,我收到一条消息,内容是:

2015-10-25T02:10:54.549219Z 1 [Note] A temporary password is generated for root@localhost: R>gFySuiu23U

If you lose this password, please consult the section How to Reset the Root Password in the MySQL reference manual.

太奇怪了,我从未见过这样的信息。之后,我通过“首选项窗格”启动了MySQL,然后/usr/local/mysql/bin/mysql -v在终端上使用命令进行下一步。我收到一条错误消息,说:

ERROR 1045 (28000): Access denied for user 'cheetah'@'localhost' (using password: NO)

我也尝试通过Sequel Pro使用root作为用户名和空白密码来访问数据库,但访问拒绝消息显示:

Unable to connect to host 127.0.0.1 because access was denied.

Double-check your username and password and ensure that access from your current location is permitted.

MySQL said: Access denied for user 'root'@'localhost' (using password: NO)

好的,我也再次尝试使用root作为用户名,但使用’R> gFySuiu23U’作为密码(由MySQL生成)。我收到连接失败的消息,说:

Unable to connect to host 127.0.0.1, or the request timed out.

Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).

MySQL said: Your password has expired. To log in you must change it using a client that supports expired passwords.

我该如何解决这个问题?我记得MySQL从来没有自动生成过这样的临时密码,不是吗?


阅读 704

收藏
2020-05-17

共1个答案

一尘不染

尝试这个:

mysql -u root -h 127.0.0.1 -p
Enter password: (enter the random password here)

参考:https : //dev.mysql.com/doc/refman/5.7/en/data-
directory-initialization-
mysqld.html

之后,您可以使用 ALTER USER 'root'@'localhost' IDENTIFIED BY 'new-password';

2020-05-17