version:6.7.6+
1、创建用户:
create user username identified by ‘myPassword‘;
或
create user ‘test‘@‘127.0.0.1‘ ;
2、修改密码:
alter user test identified by ‘test‘;
3、设置权限
grant all privileges on mydb.* to ‘test‘@‘%‘ identified by ‘test‘;
给 mydb 库 * (所有对象) all (所有权限),设置密码‘test’,‘%’ 匹配所有ip
privileges 代表权限select,insert,update,delete,create,drop,index,alter,grant,references,reload,shutdown,process,file等14个权限
例子:mysql>grant select,insert,update,delete,create,drop on test.hr to [email protected] identified by ‘123‘;
设置 增、删、改、查、删表权限给 [email protected]
4、保存,退出。
flush privileges; \q;
原文地址:https://www.cnblogs.com/coolen/p/9255279.html
时间: 2024-10-09 15:45:45