Mysql修改管理员密码

来源:互联网 发布:图片提取文字软件 编辑:程序博客网 时间:2024/05/16 18:37

使用一个非常有用的mysql启动参数:

--skip-grant-tables

就是在启动mysql时不启动grant-tables授权表。

操作方法:

1、杀掉原来进行着的mysql:

rcmysqld stop       或者:service mysqld stop       或者:kill -TERM mysqld

2、以命令行参数启动mysql:

/usr/bin/mysqld_safe --skip-grant-tables &

3、修改管理员密码:

use mysql;update user set password=password('yournewpasswordhere') where user='root';flush privileges;exit;

4、杀死mysql,重启mysql