隨筆-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 我愛佳娃 閱讀(2951) 評論(1)  編輯  收藏 所屬分類: 服務配置

          評論:
          # re: DEBIAN下的MYSQL的ROOT密碼重設 2009-02-19 22:43 | fanzhiyong
          方法三,不行  回復  更多評論
            
          主站蜘蛛池模板: 喀喇| 夹江县| 炎陵县| 陆河县| 梁河县| 天津市| 康定县| 日照市| 昆山市| 金山区| 措美县| 峨眉山市| 仁寿县| 桃园县| 安徽省| 凤城市| 丘北县| 新乐市| 巴林右旗| 龙川县| 灌阳县| 隆化县| 达拉特旗| 玉溪市| 昭苏县| 高邑县| 滦平县| 乌苏市| 六盘水市| 木里| 苍溪县| 九江市| 梅州市| 庆元县| 徐水县| 名山县| 泰安市| 佛坪县| 库伦旗| 武隆县| 辽阳县|