Mysql 创建,授权,删除,修改用户
1、创建新用户
a.登录root:mysql -u root -p; b.创建用户:insert into mysql.user(host,user,password) values("localhost","shexiao",password("20131124")); c.刷新系统权限表:flush privileges;
2、授权
a.登录root; b.创建一个数据库:create database newdb; c.授权用户shexiao在数据库newdb的所有权限:grant all privileges on newdb.* to shexiao@localhost identified by "20131124"; 或者 授权一部分权限:grant select,update on newdb.* to shexiao@localhost identified by "20131124"; d.刷新系统权限表:flush privileges;
3、删除用户
a.登录root; b.删除用户:delete from mysql.user where user="shexiao" and host="localhost"; c.刷新系统权限表:flush privileges; d.删除相关的数据库;
4、修改用户密码
a.登录root b.update mysql.user set password=password("20131125") where user="shexiao" and host="localhost"; c.刷新系统权限表:flush privileges;