ITeye博客

mysql创建用户和忘记root密码

pujing · 2011-04-21 01:21 · 互联网技术 · 操作系统 · Markdown

1.创建mysql用户

grant all on myidb.* to myidb@'localhost' identified by'password'; revoke all on myidb.* from myidb@'localhost';

说明: 除grant/revoke命令,其他与权限相关的修改都要执行flush privileges 才能生效。

2.修改mysql的root用户密码

mysql>use mysql mysql>update user set password=PASSWORD('Newpasswor') whereuser='root'; #/etc/rc.d/init.d/mysqld restart

3.忘记mysql的root密码

1)vi /etc/my.cnf 2)在[mysqld]下加入一行 skip_grant_tables 3)#/etc/rc.d/init.d/mysqld restart 4)#mysql -u root 5)mysql>use mysql; mysql>update user setpassword=PASSWORD('Newpassword') where user='root'

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。