How to migrate an MySQL database to Cloud SQL

How to migrate an MySQL database to Cloud SQL?

What is Cloud SQL:- 

While building the application we need relational database for transaction processing MySQLis when needed On Google cloud platform we use Google cloud SQL as MySQL we can also create, update and configure. The Google cloud SQL is the MySQL Database which is hosted on Google Cloud platform. As this is service is provided by google cloud it does not require any maintenance and installation. It reduces cost and storage capacity management.

Download our ebooks

Get directly to your inbox

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

  1. Create file from MySQL server for that login into MySQL server, and go to mysql dump and then export database to file with following instructions  mysqldump — databases database_name-h localhost -u blogadmin -p — hex-blob — skip-triggers — single-transaction — default-character-set=utf8mb4 >database_name.sql 
  2. Now create cloud storage bucket for that open cloud shell using following command gsutil mb gs://[bucket-name]  Note:bucket-name refers to a Unique Name we have to give. 
  3. Now copy this file in GCP Bucket For that use following command gsutil cp ~/database_name.sql gs://[bucket-name] 
  4. Now In GCP Console, Navigate to SQL And click to Create instance Then Click on MySQL and Rename it. Generate then password and click on Create button.
  5. From GCP bucket Import the database into Cloud SQL for SQL Server Following are the steps for importing database into Cloud SQL 
  • Go to Cloud SQL From the GCP console 
  • Click on the SQL instance name then click on the Database tab. 
  • Create Database. 
  • Enter the database name then click on Create. 
  • Navigate to the overview tab and click on import. 
  • In source field, browse the SQL file from cloud storage bucket which we have created already. 
  • Select format of file as SQL. 
  • In the destination field, select the database name which you created just now. 
  • Click on Import to start the process. 
Get free consultation from our tech experts

Get free consultation from our tech experts

Schedule a discussion
Get free consultation from our tech experts
Get free consultation from our tech experts

Related Posts

Aligned to business domains to provide deep expertise to solving and enabling business units
Connect With Us

Request a Consultation