mysql5.7 修改密码,修改权限

1.修改数据库对指定用户和ip权限

  a. IP为192.168.0.1的用户jack拥有对数据库datebase的表table的 增删改查权限, ,连接密码为password

 grant select,insert,update,delete,create,drop on database.table to jack@192.168.0.1 identified by 'password';

  b. 192.168.0.1的用户jack拥有对数据库datebase所有表的所有操作权限,连接密码为password

grant all privileges on datebase.* to jack@192.168.0.1 identified by 'password';

  c. 192.168.0.1的用户jack拥有对所有数据库所有表的所有操作权限,连接密码为password 

grant all privileges on *.* to jack@192.168.0.1 identified by 'password';

2.linux登录指定数据库

mysql -P'port' -h'IP' -u'username' -p'password';

3.修改数据库访问密码(mysql5.7以后mysql.user表中没有了password字段,而是使用authentication_string来代替)

update mysql.user set authentication_string=password("new password") where User="username" and Host="localhost"; 
flush privileges;
原文地址:https://www.cnblogs.com/hcl1991/p/9564759.html