linux mysql忘卻暗碼的多種處理或Access denied for user 'root'@'localhost'。本站提示廣大學習愛好者:(linux mysql忘卻暗碼的多種處理或Access denied for user 'root'@'localhost')文章只能為提供參考,不一定能成為您想要的結果。以下是linux mysql忘卻暗碼的多種處理或Access denied for user 'root'@'localhost'正文
我的體系是ubuntu6.06,比來新裝好的mysql在進入mysql對象時,老是有毛病提醒:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
應用網上引見的辦法修正root用戶的暗碼:
# mysqladmin -uroot -p password 'newpassword'
Enter password:
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: YES)'
如今終究被我找到懂得決辦法,以下(請先測試辦法三,感謝!):
辦法一:
# /etc/init.d/mysql 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
# /etc/init.d/mysql restart
# mysql -uroot -p
Enter password: <輸出新設的暗碼newpassword>
mysql>
辦法二:
直接應用/etc/mysql/debian.cnf文件中[client]節供給的用戶名和暗碼:
# mysql -udebian-sys-maint -p
Enter password: <輸出[client]節的暗碼>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <輸出新設的暗碼newpassword>
mysql>
辦法三:
這類辦法我沒有停止過測試,由於我的root用戶默許暗碼曾經被我修正過了,那位有空測試一下,把成果告知我,感謝!!
# mysql -uroot -p
Enter password: <輸出/etc/mysql/debian.cnf文件中[client]節供給的暗碼>
至此,迷惑多時的成績處理了!