CREATE USER ‘dog’@‘localhost’ IDENTIFIED BY ‘123456’;
CREATE USER ‘pig’@‘192.168.1.101_’ IDENDIFIED BY ‘123456’;
CREATE USER ‘pig’@’%’ IDENTIFIED BY ‘123456’;
CREATE USER ‘pig’@’%’ IDENTIFIED BY ‘’;
CREATE USER ‘pig’@’%’;
命令:GRANT privileges ON databasename.tablename TO ‘username’@‘host’
privileges:用户的操作权限,如SELECT,INSERT,UPDATE等,如果要授予所的权限则使用ALL
databasename:数据库名
tablename:表名,如果要授予该用户对所有数据库和表的相应操作权限则可用表示,如.*
例子:
GRANT SELECT, INSERT ON test.user TO ‘pig’@’%’;
GRANT ALL ON . TO ‘pig’@’%’;
GRANT ALL ON maindataplus.* TO ‘pig’@’%’;