centos 7忘記mysql的密碼是解決辦法

2021-08-13 22:01:38 字數 896 閱讀 5504

方法

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

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;

centos 7忘記mysql的密碼

方法 一 找回安裝是的初始密碼 1 grep temporary password var log mysqld.log 方法二 使用作業系統賬號和密碼,進行修改密碼 1 mysql uroot p 2 輸入你的centos的密碼 3 update mysql.user set authentica...

Centos7下mysql忘記root密碼處理方法

1.使用命令 vi etc my.cnf 2.在 mysqld 下新增一段 skip grant tables 3.重啟mysql服務 service mysql restart 4.使用者無密碼登入 mysql uroot p 5.選擇mysql資料庫 use mysql 6.修改root密碼 u...

centos 7忘記mysql的密碼是解決辦法

方法 一 找回安裝是的初始密碼 1 grep temporary password var log mysqld.log 方法二 使用作業系統賬號和密碼,進行修改密碼 1 mysql uroot p 2 輸入你的centos的密碼 3 update mysql.user set authentica...