mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
解決方法
[root@127 html]# /etc/init.d/mysqld stop
正在停止 mysqld: [ 確定 ]
[root@127 html]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[1] 3875
[root@127 html]# 120810 21:37:39 mysqld_safe Logging to '/var/log/mysqld.log'.
120810 21:37:39 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
mysql -u root mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> UPDATE user SET Password=PASSWORD('******') 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> quit
Bye
[root@127 html]# /etc/init.d/mysqld restart
120810 21:39:39 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
正在停止 mysqld: [ 確定 ]
正在啟動 mysqld: [ 確定 ]
[1]+ Done mysqld_safe --user=mysql --skip-grant-tables --skip-networking
[root@127 html]# mysql -uroot -p
Enter password: 輸入剛剛輸入的新密碼 ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.61 Source distribution
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
