MySql Error 1698(28000)問(wèn)題的解決方法
一,問(wèn)題描述:
MysqlERROR1698(28000)解決,新裝了mysql-server-5.7,登錄為這一問(wèn)題,普通用戶不能進(jìn)mysql,只有root用戶才能進(jìn),并且不需要任何密碼。
~$ mysql -u root -p Enter password: ERROR 1698 (28000): Access denied for user 'root'@'localhost'
二,解決步驟:
停止mysql服務(wù)
~$ sudo service mysql stop
以安全模式啟動(dòng)MySQL
~$ sudo mysqld_safe --skip-grant-tables &
MySQL啟動(dòng)之后就可以不用密碼登陸了
~$ mysql -u root Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.10 MySQL Community Server (GPL)
查看一下user表,錯(cuò)誤的起因就是在這里, root的plugin被修改成了auth_socket,用密碼登陸的plugin應(yīng)該是mysql_native_password。
mysql> select user, plugin from mysql.user; +-----------+-----------------------+ | user | plugin | +-----------+-----------------------+ | root | auth_socket | | mysql.sys | mysql_native_password | | dev | mysql_native_password | +-----------+-----------------------+ <strong>3</strong> rows in set (<strong>0.01</strong> sec)
關(guān)于auth_socket,在官方有說(shuō)明: https://dev.mysql.com/doc/mysql-security-excerpt/5.5/en/socket-authentication-plugin.html ,反正現(xiàn)在暫時(shí)不用它, 那就把這里改了。
mysql> update mysql.user set authentication_string=PASSWORD('newPwd'), plugin='mysql_native_password' where user='root';
Query OK, <strong>1</strong> row affected, <strong>1</strong> warning (<strong>0.00</strong> sec)
Rows matched: <strong>1</strong> Changed: <strong>1</strong> Warnings: <strong>1</strong>
mysql> flush privileges;
Query OK, <strong>0</strong> rows affected (<strong>0.00</strong> sec)
重啟服務(wù),問(wèn)題就解決了
~$ sudo service mysql stop ... * MySQL Community Server 5.7.10 is stopped ~$ sudo service mysql start .. * MySQL Community Server 5.7.10 is started ~$ mysql -u root -p Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.10 MySQL Community Server (GPL)
以上所述是小編給大家介紹的MySql Error 1698(28000)問(wèn)題的解決方法,希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)腳本之家網(wǎng)站的支持!
相關(guān)文章
MySQL服務(wù)啟動(dòng)與關(guān)閉如何操作圖文詳解
這篇文章主要為大家介紹了MySQL服務(wù)啟動(dòng)與關(guān)閉如何操作圖文詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪<BR>2023-10-10
window環(huán)境下使用VScode連接虛擬機(jī)MySQL方法
這篇文章主要介紹了window環(huán)境下使用VScode連接虛擬機(jī)MySQL方法,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2019-04-04
Mysql查詢語(yǔ)句如何實(shí)現(xiàn)無(wú)限層次父子關(guān)系查詢
這篇文章主要介紹了Mysql查詢語(yǔ)句如何實(shí)現(xiàn)無(wú)限層次父子關(guān)系查詢問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。如有錯(cuò)誤或未考慮完全的地方,望不吝賜教2023-07-07
MySQL用戶和權(quán)限及破解root口令的方法示例
這篇文章主要介紹了詳解MySQL用戶和權(quán)限及破解root口令,小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2019-05-05
數(shù)據(jù)庫(kù)Mysql性能優(yōu)化詳解
這篇文章主要介紹了數(shù)據(jù)庫(kù)Mysql性能優(yōu)化的相關(guān)資料,需要的朋友可以參考下2016-05-05

