进入
mysql,创建一个新用户test:
格式:grant 权限 on 数据库名.表名 用户@登录主机 identified by "用户密码";
grant select,update,insert,delete on *.* to test@192.168.0.113 identified by "test";
查看结果,执行:
select host,user,password from user;
可以看到在user表中已有刚才创建的test用户。host字段表示登录的主机,其值可以用IP,也可用主机名,
将host字段的值改为%就表示在任何客户端机器上能以test用户登录到mysql服务器,建议在开发时设为%。
update user set host = '%' where user = 'test';
PS:上面的更新,需要重启服务才可生效。