2016-06-13 132 views
0

我試圖按照所有建議here但沒有爲我工作。我已經在Fedora上安裝了mysql社區服務器mysql-community-server-5.7.9-1.fc21.x86_64MySQL無法重置「root」密碼

我試圖使用 sudo grep 'temporary password' mysqld.log訪問臨時密碼,但它不返回任何密碼。

我不斷收到錯誤 Access denied for user 'root'@'localhost' (using password: NO)

當我執行mysqld_safe的--skip-贈款表

2016-06-14 10:46:00 3495 mysqld_safe: Logging to '/var/log/mysqld.log'. chown: invalid user: ‘@[email protected]’ 2016-06-14 10:46:00 3495 mysqld_safe: The file @[email protected]/mysqld does not exist or is not executable. Please cd to the mysql installation directory and restart this script from there as follows: ./bin/mysqld_safe& See http://dev.mysql.com/doc/mysql/en/mysqld-safe.html for more information

我不能重新設置root的用戶密碼我得到這個錯誤。請幫忙。

+0

您是否嘗試過無密碼訪問? 'mysql -uroot' –

+0

此外,請參閱:http://stackoverflow.com/a/19229842/1911755 –

回答

0

RESET MySQL root密碼(對於Linux用戶)

登入根用戶和運行

Step 1# /etc/init.d/mysql stop 
Step 2# mysqld_safe --skip-grant-tables & 
Output : Starting mysqld daemon with databases from /var/lib/mysql mysqld_safe[6025]: started 

Step 3 Login to new terminal (with root user) 

    [#] mysql -u root 

mysql> use mysql; 
mysql> update user set password=PASSWORD('NEW-ROOT-PASSWORD') where User='root'; 
mysql> flush privileges; 
mysql> quit 

Step 4 # Stop MySQL Server: 

/etc/init.d/mysql stop 

Step 5 # /etc/init.d/mysql start 

mysql -u root -pNEWPASSWORD 

-------------------- - 已完成----------

+0

這不是「恢復」密碼;它只是設置一個不存在的地方。如果root用戶具有未知密碼,則「登錄到新終端(使用root用戶)」步驟將不起作用。 –

+0

我收到錯誤'mysqld_safe command not found' – Coder

+0

您可能需要登錄您的Linux機器的root用戶,那麼您將能夠訪問所有mysql命令 –