剛使用mysql, 就老是碰到這個(gè)問題,真是郁悶, 終于找到原因..
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql
ERROR 1045 (28000): Access denied for user (using password: N
O)
解決方法:
Step 1:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql -u root -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28 to server version: 5.0.24a-community-nt
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
Step 2:
C:\Program Files\MySQL\MySQL Server 5.0\bin>mysql
mysql>status
正常使用....
--------------------------------------------------
我的系統(tǒng)是ubuntu6.06,最近新裝好的mysql在進(jìn)入mysql工具時(shí),總是有錯(cuò)誤提示:
# 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)在終于被我找到了解決方法,如下(請(qǐng)先測(cè)試方法三,謝謝!):
方法一:
# /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)行過測(cè)試,因?yàn)槲业膔oot用戶默認(rèn)密碼已經(jīng)被我修改過了,那位有空測(cè)試一下,把結(jié)果告訴我,謝謝!!
# mysql -uroot -p
Enter password: <輸入/etc/mysql/debian.cnf文件中[client]節(jié)提供的密碼>
至此,困惑多時(shí)的問題解決了!
Trackback: http://tb.blog.csdn.net/TrackBack.aspx?PostId=1683765
ERROR 1045 (28000): Access denied for user 'ODBC'@'localhost' (using password: N)
更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主
微信掃碼或搜索:z360901061

微信掃一掃加我為好友
QQ號(hào)聯(lián)系: 360901061
您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。
【本文對(duì)您有幫助就好】元
