mysql8 root密碼重置

2021-10-03 09:38:36 字數 863 閱讀 6709

本篇檔案是window環境的mysql8的root密碼重置

1、關閉mysql服務

net stop mysql

2、通過沒有登入認證的方式啟動mysql

mysqld --console --skip-grant-tables --shared-memory

3、重置密碼

1)登入mysql

mysql -u root -p

不輸入密碼直接登入

use mysql

2)檢視root的密碼是否為空,如果不為空,執行如下,如果為空,直接執行3)

select user,authentication_string from user;

update user set authentication_string='' where user='root';

3)如果上面2)步驟執行查詢出來為空,執行如下:

alter user 'root'@'localhost' identified by 'firedinner123#';    --密碼要最少8位+大寫字母+小寫字母+數字

4、報錯情況

如果在執行3-3時出現如下錯誤,需要重新整理**站:

error 1290 (hy000): the mysql server is running with the --skip-grant-tables option so it cannot execute this statement

flush privileges;

mysql重置root密碼

在ubuntu 10.04上安裝了mysql,安裝時沒有要求輸入root密碼,安裝後訪問資料庫,用以下命令 mysql u root p,然後無論輸入什麼密碼都是錯誤的,只能設法重置root密碼。1.首先停止mysql服務 sudo service mysql stop 確認沒有mysql程序 ps...

mysql 重置root密碼

登入到mysql上面使用 update user set password root where user root 結果所有的root使用者的密碼的密文都變成了 root 而 root 不是真正的密碼,是加密過後的字串,所以在再次登入mysql時,使用mysql u root p 輸入密碼 roo...

mysql 重置 root 密碼

mysqld safe skip grant tables update mysql.user set authentication string password mima where user root 後沒有 password 字段 mac下安裝mysql的教程,可參考園友的文章 我安裝的版本...