mount – How to move MySQL data directory

I am trying to move the /var/lib/mysql data directory to a different drive. I have tried the solutions listed in and In both cases I had similar issues to others where mysql could not be restarted.

I finally stumbled on to a solution in the comments to this thread: How do I move the MySQL data directory? by but in order to make it work I had to add another step. Currently what Im doing is:

  1. sudo mount /dev/nvme1n1p1 /mnt/test1 – here Im mounting the other hd (/dev/nvme1n1p1) on to a folder I created (/mnt/test1)
  2. sudo rsync -avzh /var/lib/mysql /mnt/test1 – per the commentary of the thread above I copied the mysql data directory to the mounted drive, so now the mysql data is on the external hd
  3. I deleted /var/lib/mysql and created an empty directory (sudo mkdir /var/lib/mysql)
  4. sudo mount -B /mnt/test1/mysql /var/lib/mysql – here I mount the mnt/test1/mysql directory back into /var/lib/mysql

I am sure this is the wrong way to do this, so any advice on the correct process would be helpful.