若:
[root@localhost ~]# mysqladmin -u root passwd '新密碼'
mysqladmin: connect to server at 'localhost' failed
error: 'Access denied for user 'root'@'localhost' (using password: NO)'

[root@localhost ~]# service mysqld stop
[root@localhost ~]# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &
[root@localhost ~]# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('新密碼') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

[root@localhost ~]# service mysqld start
[root@localhost ~]# mysql -uroot -p
Enter password: 新密碼

mysql> \q

參考:http://blog.chinaunix.net/u1/35320/showart_305024.html


 SQL 語法:
SET PASSWORD FOR 'root'@'localhost' = PASSWORD( '****************' )

創作者介紹

ca95 台灣地誌

ca95 發表在 痞客邦 PIXNET 留言(0) 人氣()