[root@testlinux ~]# mysqladmin -u root password mysql
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user
'root'@'localhost'
(using password:
NO)'
出現這種提示表明無法修改密碼...那究竟如何才能修改密碼...
以下介紹的方法...修改roota密碼....即使root密碼忘了 也適用。。。。
step1:停止mysql服務
step2:啟動mysqld服務,加上--skip-grant-tables選項

step3:用root用戶連接mysql(這時不用輸入密碼即可進入)
step4:為root用戶設置新密碼
Type 'help;' or '\h' for help. Type '\c' to clear the
buffer.
mysql> use mysql;
Reading table
information for completion of table and column names
You can turn off this
feature to get a quicker
startup with -A
Database changed
mysql> update user set
password=PASSWORD("hello")where user="root";
Query OK, 3 rows affected (0.03
sec)
Rows matched: 3
Changed: 3 Warnings: 0
mysql> flush
privileges;
Query OK, 0 rows affected (0.01 sec)
mysql>
quit
step5:重啟mysql服務
OK...現在用root連接你會發現密碼已經改過來了。。^_^