Skip to content

Google Cloud SQL on App Engine - Connection String Outdated? #484

Closed
@lennrt

Description

@lennrt

Issue description

In the readme for this driver, the connection string for connecting to Google Cloud SQL on App Engine is given as:

user@cloudsql(project-id:instance-name)/dbname

While Google's cloudsql package documentation also affirms this for your driver, there are posts on Stack Overflow such as this one which claim that one needs to use projectid:regionname:instancename rather than projectid:instancename.

What is the correct connection string? Neither of these is currently working.

Example code

A more detailed post can be found here: http://stackoverflow.com/questions/39668672/trouble-connecting-to-google-cloud-sql-server-from-deployed-app

Error log

My server is returning a 500 response whenever I make a call to an endpoint that uses the Cloud SQL database. The database connection works fine when I am connecting to the server from a locally served version of my app.

I have tried a variety of connection strings, and here are some errors that were logged in the Google Cloud Console:

5447 [Warning] 'user' entry 'root@localhost' ignored in --skip-name-resolve mode.

5447 [Warning] entry 'root'@'localhost' in mysql.user is ignored because it duplicates entry in mysql.system_user

14409 [Note] Aborted connection 14409 to db: 'User' user: 'root' host: 'xxx.xxx.xxx.xxx' (Got an error reading communication packets)

(No password was specified in the connection string because the documentation does not specify the need for a password. This post mentions that the connection password must be null when the app attempts to connect to the server using root@localhost.)

6170 [Note] Access denied for user 'root'@'cloudsqlproxy~xx.xxx.xxx.xx' (using password: NO) 

I also tried connecting with a user other than the root user (username: newuser):

5447 [Warning] 'user' entry 'newuser@localhost' ignored in --skip-name-resolve mode.

Configuration

Driver version (or git SHA): https://github.com/go-sql-driver/mysql/tree/3654d25ec346ee8ce71a68431025458d52a38ac0

Go version: go version go1.6.2 linux/amd64

Server version: The Google Cloud SQL instance is running MySQL 5.7

Server OS: From the Compute Engine tab, it looks like the server hosting the most recent version of my app is running Debian 7.11 (Wheezy)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions