Hello Google, I am a new user and would like to know what are some properties of using the “Import” function for importing into MySQL on gcloud. Mainly when I use the “Import” option on the platform:
- When I am doing it on a existed table and database, would the old data (with different primary key) be overwritten?
- Would the old data (with the same primary key) be modified?
- Is there any other way to do the “Import”?
Thank you for your help, as I cannot find the answers in other places.
Please refer to the answer provided by Andre_Fiesco
Hello infomaccrm
To answer your questions regarding the primary key:
“Include PRIMARY KEY in the ADD clause to add a primary key to a table definition. The primary key is a unique index that does not include null values. When you specify a primary key, Zen creates a unique index with the specified attributes on the defined group of columns.
Because a table can have only one primary key, you cannot add a primary key to a table that already has a primary key defined. To change the primary key of a table, delete the existing key using a DROP clause in an ALTER TABLE statement and add the new primary key.”
Find below some links that can help you starting with MySQL:
Use the same SQL mode for import and export.
Don’t use Cloud Storage Requester Pays buckets.
Minimize the performance impact of exports.
Use the correct flags when you create a SQL dump file.
Compress data to reduce cost.
Reduce long-running import and export processes.
Use InnoDB.
MySQL import and migration jobs containing metadata with DEFINER clause.
Verify the imported database.
Additionally, here is a stackoverflow answer that can help you.
Are you following any documentation or guide for what you are trying to achieve?
1 Like
Thank you so much for your clarification. This really helps me on the work.
1 Like