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

首頁 > 數據庫 > MySQL > 正文

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

2020-01-19 00:19:06
字體:
來源:轉載
供稿:網友
我的系統是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]節提供的密碼>
至此,困惑多時的問題解決了!
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 克拉玛依市| 昭苏县| 平利县| 同心县| 田阳县| 嵊州市| 南城县| 利川市| 汽车| 宜丰县| 铜梁县| 鹿邑县| 锡林浩特市| 镇康县| 安义县| 东乡族自治县| 安福县| 阜城县| 嘉黎县| 平舆县| 商南县| 涟水县| 甘肃省| 宜丰县| 阜南县| 图木舒克市| 烟台市| 五河县| 蒲江县| 昌宁县| 讷河市| 峨眉山市| 武安市| 汽车| 和静县| 来凤县| 施甸县| 易门县| 固阳县| 乌鲁木齐县| 噶尔县|