1、创建用户
语法:grant privileges on * | *.* |db_name.* |db_name.tbl_name to 'user'@'host' identified by 'password' with with_option
例如:grant usage on db_test.tbl_user to 'super'@'localhost' identified by '123456' with grant option;
2、授权
语法:grant privileges on * | *.* |db_name.* |db_name.tbl_name to 'user'@'host' identified by 'password' with with_option
例如:grant select,update on db_test.tbl_user to 'super'@'localhost' identified by '123456' with MAX_USER_CONNECTIONS 3
;
3、撤消权限
语法:revoke privileges on * | *.* |db_name.* |db_name.tbl_name from 'user'@'host';
例如:revoke insert on db_test.tbl_user from 'super'@'localhost';
4、删除用户
语法:drop user 'user'@'host';
例如:drop user 'super'@'localhost';
5、修改密码
例如:把root密码由123456改为空
mysqladmin -uroot -p123456 password ''