Importing data into Cloud SQL
Importing data into Cloud SQL is a key subject. If we are modernizing an existing application, then there will likely be a large amount of relational data already in existence and we need to be able to import this, so we don't lose any important information.
In order to import data into our Cloud SQL instance, we will first need to export that data from an existing MySQL database and place it in a location that Cloud SQL can import from. The following section examines these steps.
Exporting data from our MySQL virtual machine
To export the data from our MySQL virtual machine, perform the following steps:
- In the command line, enter the following command:
mysqldump -u bankinguser -p --databases banking --hex-blob --set-gtid-purged=OFF --single-transaction > exported.sql
- Enter the
bankinguser
password when prompted, as follows:Enter password:
We now have a file called exported.sql
, which we will upload to a Cloud Storage...