問題描述
安裝 mysql 時,我沒有在 root 密碼字段中輸入任何內(nèi)容,但是當我運行 mysql -u root
時,我仍然收到 Access denied for user 'root'@'localhost'
.
When installing mysql, I didn't put anything in the root password fields, but when I ran mysql -u root
I still got Access denied for user 'root'@'localhost'
.
我在沒有授權表的情況下以安全模式啟動 mysql,sudo mysql_safe --skip-grant-tables &
,然后使用 mysql -u root
跳轉,沒有一個問題.
I started mysql up in safe mode without the grant tables, sudo mysql_safe --skip-grant-tables &
, then jumped in with mysql -u root
without a problem.
然后我做了使用mysql;更新用戶集 authentication_string=null where user='root';
和我得到:
Then I did use mysql; update user set authentication_string=null where user='root';
and I got:
Query OK, 0 rows affected (0.00 sec)
Rows matched: 1 Changed: 0 Warnings: 0
有人知道為什么密碼沒有更新嗎?
Anyone have any insight on why the password isn't updating?
推薦答案
我不得不將插件設置為mysql_native_password
,所以密碼重置部分看起來像這樣:
I had to set the plugin to mysql_native_password
, so the password reset part looks like this:
update user set authentication_string=password(''), plugin='mysql_native_password' where user='root'; FLUSH PRIVILEGES;
這篇關于無法將 root MySQL 密碼設置為 null的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!