進(jìn)入 /etc/my.cnf 文件,找到 [mysqld] ,在其后面添加 skip-grant-tables
vi /etc/my.cnf

image.png
重啟mysql
systemctl restart mysqld

image.png
重新登錄數(shù)據(jù)庫,搞定
mysql -u root -p

image.png
進(jìn)入 /etc/my.cnf 文件,找到 [mysqld] ,在其后面添加 skip-grant-tables
vi /etc/my.cnf
重啟mysql
systemctl restart mysqld