1. 程式人生 > >1227- Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for operation

1227- Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for operation

Centos7 MySQL8.0.16修改 root% 使用者密碼時遇到如下錯誤:

解決如下:

修改mysql登入設定

[root@localhost ~]#  vim my.cnf

在[mysqld]段中加入

skip-grant-tables

儲存之後重啟mysql服務

[root@localhost ~]# service mysqld restart

登入mysql

[root@localhost ~]# mysql -u root -p

登入後先重新整理一下(不然會報錯 :ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement

mysql> flush privileges;

修改密碼

mysql> use mysql;
mysql> alter USER 'root'@'%' IDENTIFIED BY '要修改的密碼';

再重新整理一下

mysql> flush privileges;

刪除 skip-grant-tables