天天看點

mysql 8.0.12修改密碼_MYSQL8.0.12 版本修改ROOT密碼

環境:cento 7

mysql 8.0.12

成功部署完畢後出現故障情況:

正常啟動MYSQL服務後,敲Linux中root賬戶和密碼進入不去。

從/etc/my.cnf 配置檔案中加入skip-grant-table後正常登陸,但是不能建立使用者等操作

總結來說:

想進去mysql後不能操作多指令,操作指令又不能進去mysql,死循環

挖坑環節:

網上找了很多辦法,首先加入skip-grant-table.後進去重新整理權限表,重新開機服務,不用密碼的root進去,在改root密碼後,重新重新整理權限表。方法試了很多個都不對。修改root環節始終不對。

python3 的坑 讓我想到mysql8會不會也是抛棄向下相容,更改了一些東西

先來個正确步驟:

1

systemctl stop mysqld

2

修改my.cnf

添加 skip-grant-table

儲存退出

3

systemctl start mysql

4

mysql

進入資料庫

use mysql;

5

update user set authentication_string=‘’ where user=‘root’;

6

flush privileges;

exit

7

vim /etc/my.conf

注釋 skip-grant-table

systemctl restart network

這樣就可以了

之前用的update user set password=password(‘123456’) where user=‘root’;

已經無法使用 password 字段已經改成了authentication_string字段