歡迎喜歡文章的朋友們自行轉錄,請在轉錄開頭註明出處與連結感謝各位的尊重與支持!^_^

2011年8月3日 星期三

[MYSQL]原密碼忘記的解決辦法



現象:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)


解決步驟:

# service mysqld stop
# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# service mysqld restart
# mysql -uroot -p
Enter password: <输入新设的密码newpassword>


Related Posts Plugin for WordPress, Blogger...