mysql更改密码与远程管理

set password = '123456';
#在当前用户下更改密码
grant all privileges on *.* to root@"%" identified by "new password";
#设置root用户在所有ip下都可以被访问 
grant all privileges on *.* to root@"localhost" identified by "new password";
#设置root用户可以在本地访问
flush privileges; 
#刷新权限使操作生效

注:

  *.*代表所有数据库的所有表  (x.x 第一个位置代表dbname,第二个位置代表tablename)

  root@"%" root@"localhost"这里的""里面的代表ip地址的范围

posted @ 2018-11-09 10:25  huskiesir  阅读(167)  评论(0编辑  收藏  举报