mysql 创建用户、授权、修改密码

以下操作都要在mysql所在机器操作

一、创建用户

  CREATE USER 'dog'@'localhost' IDENTIFIED BY '123456';

  或

  insert into mysql.user(Host,User,Passwordvalues('localhost','fe_group',password('123456'));

  flush privileges;

二、授权

  //授权fe_group用户拥有fe数据库的所有权限
  grant all privileges on fe.* to fe_group@localhost identified by '123456';
  //localhost是本地访问,其他地址访问不了,%是所有
  grant all privileges on fe.* to fe_group@'%' identified by '123456';
  //刷新系统权限表
  flush privileges;

三、修改密码

  update user set password=password('123') where user='root' and host='localhost';  

猜你喜欢

转载自www.cnblogs.com/qczxz/p/10174146.html
今日推荐