Google app engine 谷歌云SQL:仅从应用程序引擎拒绝访问
我在同一个项目中从AppEngine访问云SQL。我已将密码设置为root用户。我可以从mysql命令行远程连接,因此:Google app engine 谷歌云SQL:仅从应用程序引擎拒绝访问,google-app-engine,google-cloud-sql,Google App Engine,Google Cloud Sql,我在同一个项目中从AppEngine访问云SQL。我已将密码设置为root用户。我可以从mysql命令行远程连接,因此: C:>mysql -u root -h xxx.xxx.xxx.xxx -p <- IP address of my Cloud SQL Enter password: <--- I supply passw0rd Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL
C:>mysql -u root -h xxx.xxx.xxx.xxx -p <- IP address of my Cloud SQL
Enter password: <--- I supply passw0rd
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20913
Server version: 5.7.14-google-log (Google)
我得到的错误是:
com.google.gae.server.Connect getConnection: ERROR. Could not get connection. Access denied for user 'root;password=passw0rd'@'cloudsqlproxy~xxx.xxx.xxx.xxx' (using password: NO)
我只尝试了用户的url,但没有成功。感谢您的建议。发现了我的错误。Java URL应该是:
url = "jdbc:google:mysql://myproject:us-central1:myinst/mydb?user=root&password=passw0rd";
我替换了带有和现在可以工作。ya,GET请求查询参数应该与
&
而不是代码>
url = "jdbc:google:mysql://myproject:us-central1:myinst/mydb?user=root&password=passw0rd";