我搞砸了一些東西,我嘗試在mysql工作臺中創建本地服務器,但每次測試連接時都會顯示一條錯誤消息。重置Mysql工作臺root密碼
我試圖卸載MySQL的工作臺,並重新安裝,但用戶「根」是未知的。它沒有告訴任何有關在安裝過程中的root密碼,我嘗試了各種密碼,如空字符串,我的mac密碼等,但沒有一個工作,我嘗試在stackoverflow中研究,但我仍然無法解決它。當您登錄到MySQL的終端
我搞砸了一些東西,我嘗試在mysql工作臺中創建本地服務器,但每次測試連接時都會顯示一條錯誤消息。重置Mysql工作臺root密碼
我試圖卸載MySQL的工作臺,並重新安裝,但用戶「根」是未知的。它沒有告訴任何有關在安裝過程中的root密碼,我嘗試了各種密碼,如空字符串,我的mac密碼等,但沒有一個工作,我嘗試在stackoverflow中研究,但我仍然無法解決它。當您登錄到MySQL的終端
對於MAC用戶/用戶OSX
嘗試該命令FLUSH PRIVILEGES
。 如果不工作,嘗試同時在MySQL的終端
$ mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET password=PASSWORD("NEWPASSWORD") WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
更改了NEWPASSWORD
與任何密碼,您希望下面的一組命令。應該全部設置!
Update:
從MySQL 5.7開始,密碼字段已被重命名爲authentication_string
。更改密碼時,請使用以下查詢更改密碼。所有其他命令保持不變:
mysql> UPDATE user SET authentication_string=PASSWORD("NEWPASSWORD") WHERE User='root';
MySQL變更forgotted密碼
0) shut down service mysql56
1) go to C:\ProgramData\MySQL\MySQL Server 5.6
(note that ProgramData is a hidden folder)
2) look for file my.ini, open it and add one line skip-grant-tables below [mysqld],
save [mysqld]
skip-grant-tables
3) start service mysql56
4) by right, you can access the database, and use the query below to update the password
update mysql.user set password=PASSWORD('NEW PASSWORD') where user='root';
5) shun down the service again, remove the line skip-grant-tables save it, and start the service again. try to use the password you set to login.
您必須更改MySQL的服務器端的某些內容,因爲MySQL工作臺只是一個客戶端,並且與密碼設置無關。 – Capsule
我該如何改變它?在mac中,在首選項下,它只是停止mysql服務器按鈕? – KKKK
可能的重複http://stackoverflow.com/questions/17975120/access-denied-for-user-rootlocalhost-using-password-yes-no-privileges – mmuzahid