1在 /etc/my.cnf 的 [mysqld] 添加skip-grant-tables=1mysql
2重啓 數據庫systemctl restart mysqldsql
3 修改密碼數據庫
use mysqlrest
update user set authentication_string=password("123456") where user="root";code
FLUSH PRIVILEGES;