I have a Java Web application deployed on Amazon Cloud and I have migrated a local MySQL database to a remote Amazon RDS MySQL database through MySQL workbench.
In spite of having been able to connect from workbench on port 3306 to my AWS MySQL (to migrate the data) database, I am not able to connect my local Java application to the AWS MySQL database.
I am pretty sure my java driver and connection is setup right however, i keep getting this error when I run the project in Tomcat:
java.sql.SQLException: Access denied for user 'root'@'176.61.103.100' (using password: YES).
Does anybody know how to resolve this error or can anybody provide a fast track solution to getting a Java application on Amazon with a AWS MySQL database feeding in data to it?
答案 0 :(得分:0)
在MySQL中,主机可以限制用户访问。检查您拥有的用户:
SELECT host, user FROM mysql.user;
您会注意到root用户只能由特定主机访问。您需要启用对新IP的访问。
尝试使用以下工具从工作台启用通用访问:
GRANT ALL PRIVILEGES *.* TO root@'%' IDENTIFIED BY PASSWORD '<MySql root user password>';
之后再试一次,权限应立即生效。