转自:https://www.cnblogs.com/idlo/p/10872324.html
创建用户:
CREATE USER 'local_user' IDENTIFIED BY '123456';
赋予所有权限:
# 赋予 local_user 所有权限 GRANT all ON *.* TO 'local_user'@'%'; # 刷新权限(需要更新并重新连接) FLUSH PRIVILEGES; # 查看权限 SELECT * FROM user WHERE `user` = 'local_user';
回收权限:
REVOKE all ON *.* FROM 'local_user'@'%';
删除用户:
DROP USER 'local_user'@'%';