Move MariaDB ‘Data’ folder from one drive to another drive (or disk)

This article will guide you to move MariaDB database from one drive to another drive.

  1. Stop MariaDB service, or in this case, the ‘UnityISDB’ service.

  2. Copy contents of the MariaDB ‘data’ folder in the original location into the new location (new drive). Do not use the Copy/Paste function. Instead, use the Command Line tool called ROBOCOPY. 
  3. Run the Command Prompt as administrator.
  4. Enter in in the command:  ROBOCOPY drive:\source drive:\destination /E /COPY:DATASO /DCOPY:T
  5. Edit the ‘my.ini’ file in the ‘data’ folder from original location. NOTE: make a copy of the my.ini file in case
  6. Change the value called ‘datadir’to point to new location, for example:

    [mysqld]
    datadir=E:/MariaDB

  7. You can now delete the entire contents of the original ‘data’ folder EXCEPT for the ‘my.ini’ file. It should look something like this:

    Original data folder

    New 'data' folder

  8. Start the MariaDB Service, or in this case the ‘UnityISDB’ service
  9. This Completes the moving process
Was this article helpful?