linux mysql修改root密码

关闭mysql:
# service mysqld stop
然后:
# mysqld_safe --skip-grant-tables
启动mysql:
# service mysqld start
mysql -u root
mysql> use mysql
mysql> UPDATE user SET Password=PASSWORD('xxx') WHERE user='root';
mysql> flush privileges;
mysql>\q



如果可以进入mysql的话,直接
mysql> UPDATE user SET Password=PASSWORD('xxx') WHERE user='root';
mysql> flush privileges;
mysql>\q

你可能感兴趣的:(linux,mysql,数据库,linux,mysql,密码,休闲)