在用solr从mysql导入数据的时候,因为linux和本机的数据库不在同一个ip段上,

又因为本地的mysql没有设置远程其它ip可以访问所以就报了如下错误

Solr java.sql.SQLException: null,  message from server: "Host 'xxx' is not allowed to connect to this MySQL server-LMLPHP

解决办法:

在mysql任意可以输入查询命令的窗口下执行。

use mysql;
select user,host from user;
update user set host = '%' where user = 'root'

Solr java.sql.SQLException: null,  message from server: "Host 'xxx' is not allowed to connect to this MySQL server-LMLPHP

修改后成为这个样子就ok了,

最后一步就是把你的mysql服务重启,一定要重启!

host=%含义

%是通配符,host标识是设置允许访问的ip地址

例如:

  * host=localhost:只允许本机访问

  * host=169.254.18.%:只允许169.254.18.网段的可以访问

  * host=%:允许所有ip地址访问

05-11 15:25
查看更多