Search code examples
mysqlgoogle-cloud-sql

Is Cloud SQL 2nd gen. compatible with mysqldump commands?


I try to dump my Cloud SQL instance database from my local computer.

I know I should use gcloud commands but in the project I will use it would be a real pain to rewrite all the mysqldump instructions.

I can connect to Cloud SQL via the MySQL client, but when I try to use mysqldump I get the following:

mysqldump --databases testdb -h 130.211.xxx.xxx -u root -p > testdump.sql

mysqldump: Got error: 1227: Access denied; you need (at least one of) the SUPER privilege(s) for this operation when using LOCK TABLES

And of course CloudSQL doesn't support SUPER privileges... :/

Does anyone know if there's a way around?


Solution

  • According to their documentation, seems you have 2 options.
    The first, which you do not like is to use a gcloud command.
    The second, use RESTful API to access the service which is, under the hood, used by gcloud commands. You may use the same request from inside you code. Take a look here.