1、重置mysql密碼; 殺死所有的yum myql進程; pkill mysql; 查看端口 netstat -nltp;(簡單的進程用kill -9 端口號殺死) 修改my.cnf文件,在[mysqld]下加入skip-grant-tables vi /etc/my.cnf skip-grant-tables 開啟mysql服務 systemctl start mysqld.service; 進入mysql mysql -uroot -p; 再回車; 修改mysql密碼 update mysql.user set Password=password('123456') where User='root'; 執行權限 flush privileges; 2、給剛才的用戶賦予所有權限 mysql -uroot -p123456 grant all privileges on *.* to root@"%" identified by '123456';