创建用户(%表示随处可登录,localhost表示只能本地登录
create user ‘username‘@‘%‘ identified by ‘password‘;
分配权限
grant all privileges on tableName.* to ‘username‘@‘%‘;
刷新权限
flush privileges;
如果报错ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
先执行flush privileges;再进行操作