mysql创建用户,授权
1. 创建用户
1.1 命令如下
insert into user (host,user,password) values ('localhost','tiger',password('123456'));
然后,你可以试着用这个tiger用户登录一下
1.2 登录不上报错1045
原因是创建的用户不能生效,用下面命令,再试着登录
flush privileges;
2. 为用户授权
授权tiger拥有testdb数据库所有权限,命令如下:
grant all privileges on testdb.* to tiger@localhost identified by '1234';
flush privileges;//刷新系统权限表
2.1 如果某些权利给这个用户
grant select,update on testdb.* to tiger@localhost identified by '1234';
更多内容可参考 这个
3. 删除用户
DELETE FROM user WHERE User="phplamp" and Host="localhost";
4. 修改用户密码
grant all privileges on webgame_test.* to webgametest@10.3.18.158 identified by 'gametestdb';