P粉9377693562023-09-05 10:18:50
Yes: Shut down the MySQL Server services on both computers. You can then move the files in datadir any way you want. But this will cause some downtime while you're doing the file transfer.
If there must be no downtime, it is possible, but requires more steps.
What I did was use Percona XtraBackup to take a physical backup of the source instance, but this is not easy for you since you are using Windows. XtraBackup is not available for Windows. Some people use tricksDocker containers on Windows.
Then restore XtraBackup to your new machine in the normal way and configure it as a copy of the source instance. See https://docs.percona.com/percona-xtrabackup/8.0 /howtos/setting_up_replication.html
By making the new instance a replica, you can have it update based on the latest changes that occurred on the source instance when the replica was set up.
Then at some point you decide to switch to a new instance. Then, set the source instance to read-only mode to prevent client applications from making any new changes. Let the replica catch up with the last final changes (this only takes a second if the replica has already caught up with the changes). You can now change the client application to use the copy instead of the previous source. Then use RESET SLAVE to unconfigure replication on the new instance, as the last thing you want to happen is any more changes happening on the previous source and replicating to the new instance.
If you try this procedure, I recommend testing on a test instance (rather than a production instance) until you are familiar with the tools.
P.S.: Besides not supporting Windows, I don't know if the current version of XtraBackup will work with MySQL 5.5. This version was released in 2010 and discontinued in 2018. Therefore, I think you need to research which version of XtraBackup can still read MySQL 5.5 instances. You may have to use an older version of XtraBackup.