jdbc连接远程MySQL会报Host 'xxxx' is not allowed to connect to this MySQL server错误
是因为远程的MySQL数据库默认只能本地访问
修改root账户的访问权限即可
use mysql;
select host,user from user;
查看到root的host为localhost
执行update user set host='%' where user='root';
将root账户的访问客户端改为%
刷新权限,知道怎么刷新吗?哈哈哈我现在都记不住这条命令
flush privileges;
这样就可以实现远程访问了。