1、mysql更改用户权限以及密码(好用)
use mysql;
show tables;
desc user;
2、使用命令直接修改密码就行了,这里我修改root用户密码为123456为例
update user set authentication_string=password('123456') where user='root';
3、退出mysql,重启mysql服务
quit;
service mysqld restart
4、根据上一个问题原因设置skip-grant-tables 后,进入数据库使用如下命令即可
注意提示:mysql> grant all privileges on . to ‘root’@’%’ identified by ‘hzmcdba’;
ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
解决办法:flush privileges;
然后再授权就可以了。
grant all privileges on *.* to 'root'@'%' identified by '123456';
root是登陆用户,%代表的是所有ip地址都能访问, 最后就是密码。 grant是同意的意思,privileges是特权的意思,这句话就是授予root用户能在任何ip使用123456密码访问。