国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

linux mysql忘記密碼的多種解決或Access denied for user ''root''@''localhost''

2024-07-24 13:03:55
字體:
供稿:網(wǎng)友
我的系統(tǒng)是ubuntu6.06,最近新裝好的mysql在進(jìn)入mysql工具時,總是有錯誤提示:
# mysql -uroot -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
使用網(wǎng)上介紹的方法修改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)'
現(xiàn)在終于被我找到了解決方法,如下(請先測試方法三,謝謝!):
方法一:
# /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: <輸入新設(shè)的密碼newpassword>
mysql>

方法二:
直接使用/etc/mysql/debian.cnf文件中[client]節(jié)提供的用戶名和密碼:
# mysql -udebian-sys-maint -p
Enter password: <輸入[client]節(jié)的密碼>
mysql> UPDATE user SET Password=PASSWORD('newpassword') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit
# mysql -uroot -p
Enter password: <輸入新設(shè)的密碼newpassword>
mysql>

方法三:
這種方法我沒有進(jìn)行過測試,因為我的root用戶默認(rèn)密碼已經(jīng)被我修改過了,那位有空測試一下,把結(jié)果告訴我,謝謝!!
# mysql -uroot -p
Enter password: <輸入/etc/mysql/debian.cnf文件中[client]節(jié)提供的密碼>
至此,困惑多時的問題解決了!
發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 临湘市| 新沂市| 安龙县| 长宁县| 肇州县| 阿克苏市| 阳曲县| 中卫市| 丹江口市| 张家界市| 黑河市| 施甸县| 阿拉善盟| 垣曲县| 景德镇市| 疏附县| 涞水县| 永康市| 鸡东县| 涟水县| 铜陵市| 方正县| 霞浦县| 靖江市| 永宁县| 镇巴县| 旺苍县| 洪江市| 随州市| 揭东县| 万宁市| 永兴县| 科技| 深圳市| 澳门| 法库县| 扶绥县| 陆川县| 临夏县| 镇雄县| 宁都县|