[英]Google Cloud SQL: Acess Denied from App Engine only
I'm accessing Cloud SQL from App Engine in the same project. 我正在同一项目中从App Engine访问Cloud SQL。 I have set the password to the root user.
我已将密码设置为root用户。 I'm able to connect from mysql command line remotely thusly:
我因此可以从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)
However, when I try from App Engine: 但是,当我从App Engine尝试时:
Code snippet: 程式码片段:
url = "jdbc:google:mysql://myproject:us-central1:myinst/mydb?user=root;password=passw0rd";
conn = (Connection) DriverManager.getConnection(url);
The error I get is: 我得到的错误是:
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)
I have tried the url with just the user only, but no luck. 我只用用户尝试了该URL,但是没有运气。
Appreciate any suggestions. 感谢任何建议。
Found my error. 发现我的错误。 The Java URL should have been:
Java URL应该是:
url = "jdbc:google:mysql://myproject:us-central1:myinst/mydb?user=root&password=passw0rd";
I replaced the ; 我更换了; with & .
与& 。
Works now. 现在可以使用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.