今天在更新ROOT密码时出错

update user set password='123456' where user ="root"  这样写是错的

应该为update user set password = password ('123456') where user = "root"

错误操作之后,导致mysql数据库消失了。

解决方法:

关闭/etc/init.d/mysqld stop

然后,usr/bin/mysqld_safe --skip-grant-tables

启动/etc/init.d/mysqld start

mysql -u root

mysql> use mysql

mysql> UPDATE user SET Password=PASSWORD('xxx') WHERE user='root';