首先创建用户
create user '用户民'@'%' identified by '密码';
create user '用户名'@'%' identified with mysql_native_password by '密码';
flush privileges;
备注
‘%’ - 所有情况都能访问
‘localhost’ - 本机才能访问
’111.222.33.44‘ - 指定 ip 才能访问
修改密码
alter user '用户名'@'%' identified by '密码';
给用户添加数据库权限
/指定数据库
grant all privileges on 想授权的数据库.* to '用户名'@'%';
//全部数据库
grant all privileges on *.* to '用户名'@'%';
示例
create user 'user'@'123.123.123.123' identified by '123456';
flush privileges;
grant all privileges on `abc`.* to 'user'@'123.123.123.123';
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)