创建用户
create user test identified by '123456';
删除用户
DROP USER ''@'localhost'; //删除所有host为localhost的用户
给用户改名
rename user 'test'@'%' to 'newname'@'%';
给用户修改密码
SET PASSWORD FOR 'test'@'%' = PASSWORD('123456');
分配权限,以及密码
grant all privileges on *.* to root@'%' identified by '123456'; //所有权限
grant select,insert,update,delete,create,drop privileges on db.mysql to 'test'@'10.163.225.87' identified by ‘123456′
收回权限
revoke delete on *.* from 'test' @'%';
增加新用户以及分配权限
grant 权限 on 数据库.* to 用户名@登录主机 identified by "密码"
更新权限
flush privileges;
查看权限
show grants;
修改表名
RENAME TABLE tbl_name TO new_tbl_name[, tbl_name2 TO
new_tbl_name2,...]
更名是以原子方式(atomically)执行,这就意味着,当更名正在运行时,其它的任何线程均不能该表。这使得以一个空表替换一个表成为可能。
alter table table_name rename table_new_name;