求大神帮忙,JAVA远程连接MYSQL失败,本地成功
MySQL默认条件下设置了远程访问的限制。包括限制访问的IP,限制远程访问的用户。为此需要进行如下的配置:授权用户远程登录权限mysql> CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'localhost'
-> WITH GRANT OPTION;
mysql> CREATE USER 'username'@'%' IDENTIFIED BY 'password';
mysql> GRANT ALL PRIVILEGES ON *.* TO 'username'@'%'
-> WITH GRANT OPTION;修改IP限制修改: /etc/mysql/my.cnf 将其中的bind-address = 127.0.0.1 注释掉
赞0
踩0