pxblog

 

 一、登录数据库用户名密码 使用root账号登录

mysql -uroot -p密码 

 二、创建用户

create user \'s_root\'@\'%\' identified by \'123456\'; 

(%表示 可以远程登录该数据库)

如果提示 :
ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
这是由于密码太简单导致的,有两种解决方式,
1、修改数据库密码配置规则,但是不建议
2、修改密码,可以尝试使用复杂的密码,比如:Cnblogs@123

 

 三、用户授权

  格式:  grant 权限 on 数据库.*  to 用户名@登录主机 identified by ‘密码’;

//赋予s_root账号对DB数据库的所有权限

grant all privileges on DB.* to \'s_root\'@\'%\' identified by \'123456\';

//赋予”s_root“账号对“DB”数据库 只有”查询和更新“的权限

grant select,update on DB.* to \'s_root\'@\'%\' identified by \'123456\';

 

 四、刷新权限

flush privileges;

 

用户详情的权限列表请参考MySQL官网说明:http://dev.mysql.com/doc/refman/5.7/en/privileges-provided.html
权限列表

 

分类:

技术点:

相关文章:

  • 2021-12-21
  • 2021-12-18
  • 2021-07-18
  • 2021-12-29
  • 2021-07-20
  • 2021-05-17
  • 2021-12-20
  • 2021-10-04
猜你喜欢
  • 2021-12-19
  • 2021-08-23
  • 2021-12-19
  • 2021-10-02
  • 2022-02-08
相关资源
相似解决方案