MySQL Database migration to Google Cloud SQL

Tudip

Tudip

15 July 2020

Google Cloud SQL database service is a fully-managed service which provides you set up, maintenance, management, and administration for the relational databases on Google Cloud Platform.

The steps to migrate MySQL Database to Google Cloud SQL are:

  1. Create a dump file from your MySQL server.
  2. Create a Google Cloud Storage bucket.
  3. Copy the dump file in the GCP bucket.
  4. Create a Cloud SQL for SQL Server instance.
  5. Import the database into Cloud SQL for SQL Server from GCP bucket.

Mysql_to_google_cloud_sql_migration_01

  1. Create a dump file from your MySQL server: Login to the MySQL server, use mysqldump to export the MySQL database to a dump file with the following flags:
    mysqldump --databases wordpress -h localhost -u blogadmin -p --hex-blob --skip-triggers --single-transaction --default-character-set=utf8mb4 > wordpress.sql
  2. Create a Google Cloud Storage bucket: You can create a Google Cloud Storage bucket using following command
    gsutil mb gs://[bucket-name]
  3. Copy the dump file in the GCP bucket: You can copy the dump file into Google Cloud Storage bucket using this command
    gsutil cp ~/wordpress.sql gs://[bucket-name]
  4. Create a Cloud SQL for SQL Server instance: In the GCP console, navigate to SQL and click Create instance. Click on MySQL and give any name to the SQL instance, e.g. demo. Generate a root password and then click Create.
  5. Import the database into Cloud SQL for SQL Server from GCP bucket:
    1. Navigate to Cloud SQL in GCP console
    2. Click on the SQL instance name then click on the Database tab
    3. Create Database
    4. Enter the database name and choose the character set as utf8 then click on Create.
    5. Navigate to the overview tab and click on import.
    6. In source field, browse the sql dump file from cloud storage bucket
    7. Select format of file as SQL
    8. In the destination field, select the database name which you created just now.
    9. Click on Import to start the process.
      Mysql_to_google_cloud_sql_migration_02

Advantages of Google Cloud SQL

Google Cloud SQL makes your data easier for you to manage app databases with greater efficiency and security. It also creates a simple environment by leveraging some features like high availability, automated backups, and integration with Google App Engine.

Tudip Technologies

Tudip Technologies is a value-driven Software Services company. We deliver excellence in dedicated and business-centric web solutions incorporated with innovation and expertise as the tools to achieve business goals. Our high-quality, cost-effective, reliable, and scalable services have helped us build an enduring relationship with our clients and customers.

Latest Posts

  • All Posts
  • Casestudy
  • Cloud
  • Healthcare
  • Ios
  • IOT
  • Java
  • Manufacturing
  • News
  • OTT
  • Supply Chain
  • Support and Maintainance
    •   Back
    • Banking

Related Posts

  • All Posts
  • Healthcare