Importing binary logs from an external MySQL database

Skip to first unread message

Yoav Levy

Mar 15, 2021, 7:02:21 PM3/15/21
to Google Cloud SQL discuss
I would like to replicate a MySQL database that runs on a non-cloud server. I understand that master-slave MySQL replication requires the master to enable incoming connections from the slave. Since the sites I deploy to don't allow that, I opted for periodically generating and exporting binary logs, and then importing the resulting SQL into the Cloud MySQL instance (see attached file).

I run the following command:
>gcloud sql import sql spring-cloud-sql gs://retino_cloud/import_failure.sql

My problem is that the import fails with the error:
ERROR 1227 (42000) at line 1: Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN, SESSION_VARIABLES_ADMIN or REPLICATION_APPLIER privilege(s) for this operation

Is there a better way to perform the replication? If not, does GCloud MySQL support import of binary logs (transformed to SQL)?


David (Cloud Platform Support)

Mar 18, 2021, 1:09:21 PM3/18/21
to Google Cloud SQL discuss


In Cloud SQL you cannot get super privileges. However, since your end goal is to replicate from an external server, please review the relevant documentation in order to do this 1,2,3. If you require additional help in getting it accomplished, let’s say you run into errors while doing it, I would recommend you to contact GCP support as they would be able to work with you in getting the replication accomplished. Also, you could try posting any errors you may encounter in Stack Overflow and the community may be able to provide you with some insight since Google Groups is meant for conceptual discussions only versus Stack Overflow which would be a good place to post any error troubleshooting you may need assistance with.  
Reply all
Reply to author
0 new messages