mysql密码更改

1.用户修改密码;

方法一:mysqladmin -u用户 -p密码 password ‘新密码’

mysqladmin -uroot -pdefault password 'zhouli.cn'

方法二:set password=password(“new_password”);

mysql> set password=password("default");

方法三:update mysql.user set password=password('新密码') where user='用户' and host='地址';

update mysql.user set password=password("default") where user='root' and host='localhost';

flush privileges;

2.root用户修改其他用户的密码

方法一:set password for 用户@'地址'=password('新密码');

mysql> set password for user1@'localhost'=password("sql_sql");

方法二:mysqladmin -u用户 -p密码 password ‘新密码’

mysqladmin -uuser1 -pzhouzhou password 'nihao' 

3.忘记root密码如何解决

1)开启mysql服务时加上--skip-grant-tables参数即可

mysqld_safe --skip-grant-tables

mysql -uroot直接回车即可,接着用update修改root密码即可

update mysql.user set password=password("default") where user='root' and host='localhost';

上一篇:Oracle Enterprise Manager Cloud Control 12c的安装


下一篇:span表情输入框 --- Author: rose && lvyerose@163.com