前言
昨天一天都是啟動(dòng)mysql時(shí)提示:The server quit without updating PID file
,今天重裝了mysql之后還是同樣報(bào)錯(cuò),然后恢復(fù)了一下/usr/my.cnf
突然就可以啟動(dòng)了。(明明昨天/usr/my.cnf就是默認(rèn)的,有個(gè)解決方法說(shuō)改這個(gè)文件才改的)
然后現(xiàn)在就到?jīng)]有設(shè)置root密碼的問(wèn)題了,搜了幾個(gè)方法都不行,直到看到下面這個(gè)方法一才行。
解決方法一:
1
2
3
4
5
6
7
8
9
10
|
# /etc/init.d/mysql stop # 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: <輸入新設(shè)的密碼newpassword> mysql> |
解決方法二:
直接使用/etc/mysql/debian.cnf
文件中[client]
節(jié)提供的用戶名和密碼:
1
2
3
4
5
6
7
8
|
# mysql -udebian-sys-maint -p Enter password: <輸入[client]節(jié)的密碼> mysql> UPDATE user SET Password=PASSWORD( 'newpassword' ) where USER= 'root' ; mysql> FLUSH PRIVILEGES; mysql> quit # mysql -uroot -p Enter password: <輸入新設(shè)的密碼newpassword> mysql> |
總結(jié)
以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作能有所幫助,如果有疑問(wèn)大家可以留言交流。