mysql忘記密碼的處理方法

2021-08-31 18:10:26 字數 895 閱讀 3422

方法

一、找回安裝是的初始密碼:

1、grep 『temporary password』 /var/log/mysqld.log

方法二、使用作業系統賬號和密碼,進行修改密碼

1、mysql -uroot -p

2、輸入你的centos的密碼

3、update mysql.user set authentication_string = password(『mynewpassword』) where user = 『root』 and host = 『localhost』;

注:如果顯示 error 1819 (hy000): your password does not satisfy the current policy requirements,說明你的密碼不符合安全要求,

4、flush privileges;

5、quit;

方法三、強制進行修改密碼

1、systemctl stop mysqld

2、systemctl set-environment mysqld_opts="–skip-grant-tables"

3、systemctl start mysqld

4、mysql -u root

5、update mysql.user set authentication_string = password(『mynewpassword』) where user = 『root』 and host = 『localhost』;

注:如果顯示 error 1819 (hy000): your password does not satisfy the current policy requirements,說明你的密碼不符合安全要求,

6、flush privileges;

7、quit;

mysql忘記密碼的處理方法

1 首先停止正在執行的mysql程序 linux下,執行 killall term mysqld windows下,如果寫成服務的 可以執行 net stop mysql,如未載入為服務,可直接在程序管理器中進行關閉。2 以安全模式啟動mysql linux下,執行 usr local mysql ...

mysql 忘記root 密碼處理方法

第一步修改mysql配置檔案my.cnf 命令 vi etc my.cnf 把skip grant tables新增上去如圖 儲存退出 命令 wq 重啟mysql 伺服器 命令 service mysqld restart 第二步修改密碼 命令 mysql 命令 use mysql 命令 updat...

mysql忘記root密碼的處理方法

在linux下,如果忘記了mysql中root使用者的密碼可以採用以下辦法解決。1.修改my.cnf,加入skip grant tables 修改mysql的配置檔案my.cnf,在 mysqld 段增加skip grant tables mysqld skip grant tables 2.重啟m...