创建新用户:
create user 用户名 identified by '密码';
给用户分配指定数据库
- 用户 test 密码 test 数据库 testdb
-- 给用户test分配testdb数据库的所有权限(%表示可以外网连接 localhost 表示只能内网连接)
grant all privileges on testdb.* to test@"%" identified by 'test';
授予权限
-- 增删改查各种权限
grant create,alter,drop,select,insert,update,delete on testdb.* to test@'%';
刷新权限
--刷新权限
flush privileges;
查看用户有哪些权限
--查看用户“test”
show grants for test;
网友评论