Google Cloud SQL – How to import an existing database

Ok here is a small guide on how to import your existing mysql database into Google Cloud SQL.

Step 1

Export your database into a sql file.

If your on PHPMyAdmin, select your database and click export tab and export the tables as required.

localhost  localhost  survey-plan-searcher  phpMyAdmin 3.4


Step 2

Go into Google Cloud Console. And Select your Project.

Step 3

Create a bucket on Google Cloud Storage.

Google Developers Console - Mozilla Firefox_2014-08-10_19-16-33

Step 4

Upload your MySQL database export .sql file into the created bucket.

Google Developers Console - Mozilla Firefox_2014-08-10_19-17-47

Step 5

Go into Cloud SQL section on the Google Cloud Console. And Select your instance.

Google Developers Console - Mozilla Firefox_2014-08-10_19-18-36

Step 6

Click the import button on the top bar.


Step 7

Enter the path of the bucket you created on Google Cloud Storage and the .sql file you uploaded.

Google Developers Console - Mozilla Firefox_2014-08-10_19-23-57

Step 8

Important – Click the Show advanced options… link and enter your Google Cloud SQL database name in the given text box. (This is if your SQL file doesn’t specify Use Database statement.) – If you dont do this you will get an error saying “An unknown error occurred” Which is a bit cryptic, but now you know why you get it. 🙂

Google Developers Console - Mozilla Firefox_2014-08-10_19-24-46

Step 9

Click the Ok Button.

Step 10

Click the Operations tab to see the progress.

Google Developers Console - Mozilla Firefox_2014-08-10_19-25-37

Ok Now your database file is imported successfully. You can start working with your database in your app engine application.