隨筆-124  評論-194  文章-0  trackbacks-0

          轉自:這里

          我的系統是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]節提供的密碼>
          至此,困惑多時的問題解決了!

          posted on 2007-11-18 12:19 我愛佳娃 閱讀(2946) 評論(1)  編輯  收藏 所屬分類: 服務配置

          評論:
          # re: DEBIAN下的MYSQL的ROOT密碼重設 2009-02-19 22:43 | fanzhiyong
          方法三,不行  回復  更多評論
            
          主站蜘蛛池模板: 竹山县| 电白县| 万盛区| 颍上县| 沂源县| 临汾市| 左贡县| 连南| 红原县| 岐山县| 临夏市| 泊头市| 拜泉县| 枣阳市| 饶平县| 丰宁| 吉木萨尔县| 恩施市| 涡阳县| 盘山县| 阳城县| 本溪市| 东丽区| 开阳县| 衡山县| 平泉县| 屏东市| 射洪县| 犍为县| 永济市| 边坝县| 漠河县| 楚雄市| 灯塔市| 钟祥市| 广州市| 皮山县| 怀宁县| 井冈山市| 攀枝花市| 西盟|