I am using the go-sql-driver / mysql driver in the Google App Engine to connect to a Cloud SQL instance as follows:
import (
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
db, dbErr := sql.Open("mysql", "root@cloudsql(project:instance)/database"
...
pingErr := db.Ping()
but I get " resolved rejection " in pingErr.
Of course, I checked that my application is allowed in the Cloud SQL console in the "Access Control" section for documents . I also tried to add the MySQL user with privileges and use user:passwordinstead rootand not even specify the user.
What am I doing wrong?
...
Update:
Per @Kyle sentence I tried the alternative ziutek / mymysql driver and works with the following code:
import (
"database/sql"
_ "github.com/ziutek/mymysql/godrv"
_ "github.com/ziutek/mymysql/mysql"
_ "github.com/ziutek/mymysql/native"
)
db, dbErr := sql.Open("mymysql", "cloudsql:project:instance*database/user/password"
go-sql-driver/mysql, , ! !