--
停止 MySQL 之後增加 skip-grant-tables 到 my.cnf [mysqld] 區域
1 2 3 4 5 6 |
# systemctl stop mysqld # vi /etc/my.cnf [mysqld] skip-grant-tables # systemctl start mysqld |
進入 MySQL 後設定 root 新密碼
1 2 3 4 |
# mysql -u root -p use mysql; update mysql.user set authentication_string=password('new password') where user='root'; flush privileges; |
將 my.cnf skip-grant-tables 設定移除,重新啟動 MySQL
1 2 |
# vi /etc/my.cnf # systemctl restart mysqld |
--
315 total views, 1 views today