簡體   English   中英

MySQL無法重置“ root”密碼

[英]MySQL unable to reset 'root' password

我嘗試遵循此處的所有建議但沒有一個對我有用。 我已經在Fedora上安裝了mysql社區服務器mysql-community-server-5.7.9-1.fc21.x86_64

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

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

我執行mysqld_safe --skip-grant-tables時收到此錯誤

2016-06-14 10:46:00 3495 mysqld_safe: Logging to '/var/log/mysqld.log'. chown: invalid user: '@MYSQLD_USER@' 2016-06-14 10:46:00 3495 mysqld_safe: The file @libexecdir@/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的用戶密碼。 請幫忙。

對於centos上的mysql 5.7

systemctl stop mysqld
systemctl set-environment MYSQLD_OPTS="--skip-grant-tables"
systemctl start mysqld
mysql -u root
mysql> use mysql; 
mysql> update user set authentication_string=password('you new pass') where 
user='root';
mysql> flush privileges; 
mysql> exit

systemctl restart mysqld

重置MYSQL根密碼(對於Linux用戶)

登錄到root用戶並運行

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

---------------------完成----------

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM