mysql 给数据库设置单独的账号密码

发布于 2019-12-25 17:41:20
  1. 登陆数据库并进入数据库命令行界面。如果是用Navicat 可以在查询里操作

image.png

  1. 授权命令:
grant all privileges on 数据库.* to '账号'@'作用域' identified by '密码';

其中作用域,如果只开放本地使用填:localhost, 远程则填 %

例如:

grant all privileges on test.* to 'abc'@'localhost' identified by 'abc123456';
  1. 刷新数据库,使之生效
flush privileges;
0 条评论

发布
问题