root账号
拥有mysql的所有权限
创建语句
grant all privileges on *.* to 'root'@'%' identified by 'password' with grant option;
flush privileges;
项目专用账号
对项目专用的数据库有所有权限,除了对项目的数据库有权限,对其他数据库无任何权限
创建语句:
grant all privileges on `项目数据库`.* to 'username'@'%' identified by 'password';
flush privileges;
指定部分权限给专用账户
grant select,update on `项目数据库`.* to 'username'@'%' identified by 'password';
flush privileges;
给开发人员创建的只读账号
grant select on `项目数据库`.* to 'username'@'%' identified by 'password';
flush privileges;
删除用户
delege from user where user='username'and host='%';
flush privileges;
删除数据库
drop database `databasename`;
修改指定用户密码
update user set password=password('new_password')where user='username'and host='%';
flush privileges;