Content Groups
Contents
Tags

在项目中,一般不会直接使用 root 账号,可以创建一个新用户,并为这个用户授予管理指定数据库的权限,如下所示:

 

1.  创建用户

账号:test

密码:123456

create user 'test'@'%' identified by '123456';

2.  授予权限

数据库:demo

all privileges:授予所有可用的权限

flush privileges:刷新权限表

grant all privileges on demo.* to 'test'@'%';
flush privileges;

3.  检查权限

show grants for 'test'@'%';