2

I'm moving data directory from D drive which has raid controller hard disk to C drive where OS installed on windows environment.

Here is the issues:

Stop Mysql server
open my.ini --> data directory -> "C drive path"
copy data directory folder to c drive folder
start mysql server

Will it work as this is innodb engines, I have heard we need to restore back as .sql files , copying raw file from one place to another doesn't work.
Is it true or do you have any other workaround as there is 600 GB data size?

1 Answer 1

1

You can try with below steps.

  1. Stop the existing MySQL instance using services.msc, shutdown must be clean so that the instance flushes any pending changes to disk.
  2. After successful instance shutdown, copy the data directory from existing location to the new location. Existing location: C:\ProgramData\MySQL\MySQL Server 5.7 New Location: E:\MySQL
  3. Change datadir parameter in current my.ini file. I have commented old entry and added new one: #datadir=C:/ProgramData/MySQL/MySQL Server 5.7\Data datadir=E:\MySQL\Data
  4. Start MySQL instance using services.msc
  5. After starting MySQL successfully, you can verify above changes by creating temporary database and verify data directory for the same database.
5
  • Are you sure it will work same with Innodb files ,as this process worked for only myisam tables i heard. Please make sure it is correct?
    – SAM AB
    Commented Jul 5, 2017 at 9:29
  • @SAMAB Yes, I works for both engine types. If you have any doubt I would suggest to perform steps on any local machine with mixture of engines or any single type according to your requirement.
    – akumar
    Commented Jul 5, 2017 at 9:33
  • if i did these steps ,after that i will query like this "select * from employee" ,will it show results or it will throws an error like 'employee table doesn't exist'
    – SAM AB
    Commented Jul 5, 2017 at 12:48
  • @SAM AB it should not throw error if you follow steps properly. You can check the appropriate permissions on new data directory if you are getting such error.
    – akumar
    Commented Jul 5, 2017 at 12:58
  • Everything (except my.cnf) that MySQL needs is in that single directory tree. So, moving the tree works and changing the pointer to it works. For all engines. Log files are a possible exception -- but there are other VARIABLES pointing to them so that they can be controlled separately.
    – Rick James
    Commented Jul 9, 2017 at 15:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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