mysql密码重置

 

/usr/local/mysql/bin/mysql已经配置了环境变量

默认没有给mysql设置密码

设置密码mysqladmin


密码重置

1. 编辑mysql主配置文件 my.cnf
vim /etc/my.cnf  
在[mysqld]字段下添加参数  skip-grant  
2. 重启数据库服务
service mysqld restart
3. 这样就可以进入数据库不用授权了
mysql -uroot 
4. 修改相应用户密码
use mysql;
update user set password=password('your password') where user='root';
flush privileges;
5.  修改/etc/my.cnf 去掉 skip-grant , 重启mysql服务

 

posted @ 2015-09-15 15:08  沐风先生  阅读(145)  评论(0编辑  收藏  举报