When migrating to a unique model than your supply database, your supply and vacation spot databases might have totally different values for the
sql_mode flag. The SQL mode defines what SQL syntax MySQL helps and what forms of information validation checks it performs. For example, the default SQL mode values are totally different between MySQL 5.6 and 5.7.
Consequently, with the default SQL modes in place, a date like
0000-00-00 could be legitimate in model 5.6 however wouldn’t be legitimate in model 5.7. Moreover, with the default SQL modes, there are modifications to the behavior of
GROUP_BY between model 5.6 and model 5.7. Examine to make sure that the values for the
sql_mode flag are set appropriately in your vacation spot database.
You may be taught extra about the
sql_mode flag and what the totally different values imply within the MySQL documentation.
Earlier than you’ll be able to proceed with the migration, there are a number of conditions it’s worthwhile to full. We now have a quickstart that exhibits all the steps for migrating your database, however what we need to deal with on this put up is what it’s worthwhile to do to configure your supply database, and we’ll additionally briefly describe organising a connection profile and configuring connectivity.
Configure your supply database
There are a number of steps it’s worthwhile to take to configure your source database. Please observe that relying in your present configuration, a restart in your supply database could also be obligatory to use the required configurations.
Cease DDL write operations
Earlier than you start emigrate information from the supply database to the vacation spot database, you need to cease all Information Definition Language (DDL) write operations, if any are working on the supply. This script can be utilized to confirm whether or not any DDL operations have been executed up to now 24 hours, or if there are any energetic operations in progress.
server_id system variable
One of the essential objects to arrange in your supply database occasion is the
server_id system variable. In case you are undecided what your present worth is, you’ll be able to verify by working this in your
The worth displayed have to be any worth equal or larger than 1. In case you are undecided about methods to configure the
server_id, you’ll be able to take a look at this page. Though this worth may be dynamically modified, replication will not be routinely began if you change the variable until you restart your server.
International transaction ID (GTID) logging
gtid_mode flag controls whether or not or not world transaction ID logging is enabled and what forms of transactions the logs can include. Be sure that
gtid_mode is ready to
OFF_PERMISSIVE usually are not supported with DMS.
To know which
gtid_mode you might have in your supply database run the next command:
If the worth for
gtid_mode is ready to
OFF_PERMISSIVE, when you find yourself altering it, observe that modifications to the worth can solely be one step at a time. For instance, if
gtid_mode is ready to
ON_PERMISSIVE, you’ll be able to change it to
OFF_PERMISSIVE, however to not
OFF in a single step.
gtid_mode worth may be dynamically modified with out requiring a server reboot, it is suggested that you just change it globally. In any other case, it would solely be legitimate for the session the place the change occurred and it will not have impact if you begin the migration through DMS. You may be taught extra about
gtid_mode within the MySQL documentation.
Database person account
The person account that you’re utilizing to hook up with the supply database must have these world privileges:
- REPLICATION CLIENT
- REPLICATION SLAVE
- SHOW VIEW
We advocate that you just create a particular person for the aim of migration, and you’ll quickly depart the entry to this database host as
%. Extra info on making a person may be found here.
The password of the person account used to hook up with the supply database should not exceed 32 characters in size. This is a matter particular to MySQLreplication. For extra details about the MySQL person password size limitation, see MySQL Bug #43439.
As a result of a MySQL migration job doesn’t migrate user data, sources that include metadata outlined by customers with the DEFINER clause will fail when invoked on the brand new Cloud SQL reproduction, because the customers do not but exist there.
You may determine which
DEFINER values exist in your metadata through the use of these queries. Examine if there are entries for both
rootpercentlocalhost or customers that do not exist within the goal occasion.
SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA.EVENTS;
SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA.ROUTINES;
SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA.TRIGGERS;
SELECT DISTINCT DEFINER FROM INFORMATION_SCHEMA.VIEWS;
In case your supply database does include this metadata you are able to do one of many following:
- Replace the
INVOKERin your supply MySQL occasion previous to organising your migration job.
- Create the customers in your goal Cloud SQL occasion earlier than beginning your migration job.
Create a migration job with out beginning it. That’s, select Create as an alternative of Create & Begin.
Create the customers out of your supply MySQL occasion in your goal Cloud SQL occasion utilizing the Cloud SQL API or UI.
Begin the migration job from the migration job listing or the precise job’s web page.
Allow binary logging in your supply database, and set retention to a minimal of two days. We advocate setting it to 7 days to reduce the chance of misplaced log place. You may be taught extra about binary logging within the MySQL documentation.
All tables, besides tables in system databases, will use the InnoDB storage engine. In the event you want extra details about changing to InnoDB, you’ll be able to reference this documentation on converting tables from MyISAM to InnoDB.
Arrange a connection profile
A connection profile represents all the data it’s worthwhile to join to a knowledge supply. You may create a connection profile by itself or within the context of making a particular migration job. Making a supply connection profile by itself is helpful if the one who has the supply entry info will not be the identical one that creates the migration job. You can even reuse a supply connection profile definition in a number of migration jobs.
Study extra about connection profiles and methods to set them up in the documentation.
DMS presents a number of alternative ways you can arrange connectivity between the vacation spot Cloud SQL database and your supply database.
There are 4 connectivity strategies you’ll be able to select from:
The connectivity method you choose will depend on the type of source database, and whether it resides on-premises, in Google Cloud, or in another cloud provider. For a more in-depth look at connectivity, you can read this blog post.
Now that you have realized methods to put together your MySQL database for migration, you’ll be able to go to the DMS documentation to get began, or proceed studying by studying these weblog posts: