我的版本为5.7.11
下面这种方法已经不行。
insert into user(User,Host,Password) values('test','%',password('123123'));
所以只能使用另一种方法
create user 'test'@'%' identified by '123123';
查看用户
select host,user from mysql.user;
授权某数据操作给用户
grant all privileges on testDB.* to 'test'@'%';
flush privileges;
我遇到了一个问题:创建帐号之后,用密码无法登录,但不用密码可以登录(本地),远程可以登录,然后查了一下发现有两个帐号的user为空,把user为空的那两行给删掉就可以了。。