忘記root密碼怎麼辦?以下的方法幫你重新設定密碼。
# mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
# service mysqld stop //停止服務
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking& //在安全模式下執行
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('輸入新密碼')where USER='root';
Query OK, 0 rows affected (0.01 sec)
Rows matched: 3 Changed: 0 Warnings: 0
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> quit
Bye
# mysql -u root -p
Enter password:
mysql>
沒有留言:
張貼留言