mysql修改root密碼


mysql8.0.16

登錄時出現ERROR 1130 (HY000): Host 'localhost' is not allowed to connect to this MySQL server
出現此錯誤時,是root用戶權限問題,客戶端無法訪問服務器
判斷本次出現問題原因為:安裝mysql后修改密碼,修改密碼使用了明文密碼導致問題出現
update mysql.user set authentication_string='password' where user='root';
使用此方法修改密碼就會出現此問題,正確修改密碼方式如下
1、客戶端無法登錄mysql服務器,需要越權登錄
mysqld --console --skip-grant-tables --shared-memory
2、越權可以直接通過mysql命令直接登錄,然后進入user表將root用戶密碼修改為空,可使用update命令
3、退出mysql關閉1中打開的console,重啟mysql,重新修改密碼
alter user ‘root'@'localhost' identified by 'password'//此方法修改后的密碼為加密的
網上有些修改密碼方式為:
update mysql.user set authentication_string=password('password') where user='root';
嘗試后無效,報錯,猜測是password方法已經不被使用了

成功修改密碼后,進入mysql,show databases和show tables 無法使用

mysql 8.0ERROR 1449 (HY000): The user specified as a definer ('mysql.infoschema'@'localhost') does not exist

猜測為mysql自身的表依賴問題,不知道怎么解決,重新生成data文件

1、關閉mysql :net stop mysql

2、重新初始化:mysqld --initialize --console

3、修改mysql密碼

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM