2014年4月30日 星期三

Access denied for user 'root'@'localhost' (using password: NO)'

http://magicsun.pixnet.net/blog/post/25768313-mysqladmin%3A-connect-to-server-at-%27localhost%27-failed-%E8%99%95%E7%90%86

SUSE 10.3上裝完MYSQL
啟動時都正常,但要設定密碼時出現錯誤
SU103:/ # /etc/init.d/mysql start
Starting service MySQL                                               done
SU103:/ # mysqladmin -u root password 'xxxxxxxx'
mysqladmin: connect to server at 'localhost' failed error: 'Access denied for user
'root'@'localhost' (using password: NO)'
處理方式如下
SU103:~ # service mysql stop
Shutting down service MySQL                                          done
SU103:~ # clear
SU103:~ # mysqld_safe --skip-grant-tables &[1] 19984
SU103:~ # nohup: ignoring input and redirecting stderr to stdout
Starting mysqld daemon with databases from /var/lib/mysql
SU103:~ # mysql -u root mysqlWelcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.0.45 SUSE MySQL RPM
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> UPDATE user SET Password=PASSWORD('xxxxxx') where USER='root';Query OK, 3 rows affected (0.00 sec)
Rows matched: 3  Changed: 3  Warnings: 0
mysql> FLUSH PRIVILEGES;Query OK, 0 rows affected (0.00 sec)
mysql> quitBye
SU103:~ # /etc/init.d/mysql restartRestarting service MySQL
Shutting down service MySQL                                          done
Starting service MySQL                                               done
SU103:~ # mysql -u root -pEnter password:xxxxxxWelcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45 SUSE MySQL RPM
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
打完收工~~~

沒有留言:

張貼留言