C:\>mysqladmin -uroot -p password woshiduide
Enter password: ******
于是修改成功。
注意PASSWORD关键字后面的空格
有好多人是这样修改的:
C:\>mysqladmin -uroot -p password 'woshiduide'
Enter password: ******
C:\>mysqladmin -uroot -p password 'woshiduide'
Enter password: *********
Warning: single quotes were not trimmed from the password by your command
line client, as you might have expected.
而这个时候真正的密码是'woshiduide'
C:\>mysql -uroot -p'woshiduide'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 18
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
而新手往往这样:
C:\>mysql -uroot -pwoshiduide
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: Y
ES)
所以非常郁闷,BAIDU、GOOGLE的搜了一大堆。
我现在把密码改回去。
C:\>mysqladmin -uroot -p'woshiduide' password 123456
2、还有就是可以直接进入MYSQL,然后修改密码。
mysql> use mysql
Database changed
mysql> update user set PASSWORD = PASSWORD('woshiduide') where USER='root' and H
OST='localhost';
Query OK, 1 row affected (0.05 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> flush privileges;
mysql> exit
Bye
C:\>mysql -uroot -pwoshiduide
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 23
Server version: 5.1.17-beta-community-nt-debug MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.