1、创建用户 create user 'username'@'host' identified by 'password' 例如:create user 'test'@'127.0.0.1' identified by '123456'; 2、授权 grant privileges on databaseName.tableName to 'username'@'host' 例如:grant all on *.* to 'test'@'127.0.0.1'; privileges包括select insert update 3、修改密码 set password for 'username'@'host' = password('newpassword') 例如:set password for 'test'@'127.0.0.1' = password('123') 4、回收权限 revoke privileges on databaseName.tableName from 'username'@'host' 例如:revoke all on *.* from 'test'@'127.0.0.1';