数据库 创建&授权

创建数据库

CREATE DATABASE testdb CHARACTER SET utf8 COLLATE utf8_general_ci;

创建表

CREATE TABLE mytable(
id varchar(40) NOT NULL default '',
userId varchar(40) NOT NULL default ''
) ENGINE=InnoDB DEFAULT CHARSET=utf8;

用户授权

grant 权限 on 数据库对象 to 用户

grant select, insert, update, delete on testdb.* to user@'%'

普通dba权限

grant all privileges on testdb to user@'localhost'

高级dba权限

grant all on *.* to user@'localhost'

猜你喜欢

转载自www.cnblogs.com/zhouyujiang/p/10201821.html