I have a instance of MySQL in a local server. To improve the performance, I put a SSD just for MySQL.

Now I need migrate the MySQL instance, with my databse (a data has 25GB) for the SSD.

What the best way to do that? I thinked in export the data and after reinstall the MySQL in SSD and import the data again. But how is a big database, I will have a large downtime.

Are there a another way?

  • 1
    Stop service. Make a copy of all server data directory to the SSD (for example, all C:\ProgramData\MySQL\MySQL Server 8.0 folder). Edit all paths in my.ini in new location to new values. Edit service command line, specify new my.ini. Edit all another shortcuts (CLI, for example). Start service. – Akina Jan 29 '20 at 12:42
  • Is your server Linux or Windows? – Jesus Uzcanga Jan 29 '20 at 16:45

For linux (as root user)

  1. Stop mysql service through systemctl
  2. rsync or cp -a the whole of /var/lib/mysql to your preferred destination.
  3. mv /var/lib/mysql /var/lib/mysql-old
  4. edit mysql configuration file and change datadir= under mysqld
  5. Start mysql service through systemctl.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.