如果mysql的root密碼忘了怎麼辦

zh515858237發表於2015-06-27

原文連結:http://www.rackspace.com/knowledge_center/article/mysql-resetting-a-lost-mysql-root-password

sudo /etc/init.d/mysqld stop

sudo mysqld_safe --skip-grant-tables &

mysql -u root

use mysql;

update user set password=PASSWORD("mynewpassword") where User='root';

flush privileges;

quit

/etc/init.d/mysqld stop

/etc/init.d/mysqld start

mysql -u root -p

相關文章