从App Engine连接到CloudSQL

I have a Go app running on App Engine, and a first generation CloudSQL instance running. I can connect to the SQL server from dev using a TCP connection, specifying the SQL server's IP. But I cannot connect from the deployed instance, using the CloudSQL driver.

Sample code

import (
    "database/sql"
    _ "github.com/ziutek/mymysql/godrv"
    _ "google.golang.org/appengine/cloudsql"
)

if (dev) {
    sql.Open("mymysql", "tcp:1.2.3.4:3306*database/user/pass")
} else {
    sql.Open("mymysql", "cloudsql:project-id:instance-name*database/user/pass")
}

(Yes, I'm substituting database, user, pass, project-id, and instance-name for their correct values in my real code)

When running locally (via goapp serve) I can connect and query the database - everything works great. However, when connecting from the deployed instance, I get the following error:

Received #1045 error from MySQL server: "Access denied for user 'readonly'@'localhost' (using password: YES)"

I have made sure that my App Engine instance is authorized (SQL > Instance > Access Control > Authorization), and I'm using the same user in both cases.

I've found something resembling my error message on the Diagnosing Issues with Cloud SQL Instances page, but the suggested solution is to connect with SSL if SSL is enabled (I have not enabled SSL for the server).

If you get an error message like:

ERROR 1045 (28000): Access denied for user 'root'@'1.2.3.4' (using password: YES)

when you connect, verify that you are using the correct password and that you are connecting over SSL if the instance requires it.

Seeing as how this has given me so much trouble, I also tried connecting via IP address from the App Engine instance, but the socket connection is denied.