溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

忘記mysql密碼怎么辦

發(fā)布時間:2020-04-29 12:00:04 來源:億速云 閱讀:309 作者:三月 欄目:MySQL數(shù)據(jù)庫

下文主要給大家?guī)硗?a title="mysql" target="_blank" href="http://www.kemok4.com/mysql/">mysql密碼怎么辦,希望這些文字能夠帶給大家實際用處,這也是我編輯這篇文章的主要目的。好了,廢話不多說,大家直接看下文吧。

centos系統(tǒng)

1】mysql5.6.x環(huán)境

centos6.x關閉mysql

# /etc/init.d/mysql stop

centos7.x關閉mysql

#systemctl stop mysqld

# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &

# mysql -u root mysql

mysql> UPDATE user SET Password=PASSWORD(’newpassword’) where USER=’root’;

mysql> FLUSH PRIVILEGES;

mysql> quit

# /etc/init.d/mysql restart

# mysql -uroot -p

Enter password: <輸入新設的密碼newpassword>

mysql> 

忘記mysql密碼怎么辦

2】mysql5.7.x環(huán)境

#vim /etc/my.cnf

 [mysqld]

  skip-grant-tables

 :wq! #保存退出

//登錄數(shù)據(jù)庫

#mysql -uroot -p

>UPDATE user SET Password=PASSWORD("userpasswd") where user="username";

> flush privileges;

> quit

//把 /etc/my.cnf 的 skip-grant-tables 這行注釋掉

//重啟服務

#systemctl restrt mysqld

到此,已可以成功登錄了?。。?!

對于以上關于忘記mysql密碼怎么辦,大家是不是覺得非常有幫助。如果需要了解更多內(nèi)容,請繼續(xù)關注我們的行業(yè)資訊,相信你會喜歡上這些內(nèi)容的。

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI