CREATE USER 'username'@'%' IDENTIFIED BY 'password';
例子
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'
例子
GRANT SELECT, INSERT ON test.user TO 'pig'@'%';
GRANT ALL ON *.* TO 'pig'@'%';
GRANT ALL ON maindataplus.* TO 'pig'@'%';
刷新权限
FLUSH PRIVILEGES;
删除用户
DROP USER 'username'@'host';
网友评论