Home:ALL Converter>How to change MySQL data directory on windows?

How to change MySQL data directory on windows?

Ask Time:2014-10-30T16:19:56         Author:Erick Leddel

Json Formatter

I went to this location C:\ProgramData\MySQL\MySQL Server 5.6 to find my.ini, then I modified the datadir to: datadir=C:/ProgramData/MySQL/MySQL Server 5.6/Dataz

I only added the letter z to the original path, then I created the dataz folder in the MySQL Server 5.6 directory.

then i closed and opened mysql to restart it

I haven't been able to make it work. What am i missing?

2 hours later...

I wasn't restarting mysql server properly, I was only clicking the mysql command client close button. someone told that I had to restart the computer for the changes to take effect, if didn't know how to restart mysql server properly.

After doing this the dataz folder had new files. this is new because I wasn't be able to create this files before They appeared after I restart the computer.

Now, MySQL command client shows an error and closes itself after I enter my password. I can't see the error because the error is shown for one second or less

Author:Erick Leddel,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/26648045/how-to-change-mysql-data-directory-on-windows
Gianluca Colombo :

If you change the data directory, you have to copy or move all the data inside, to the new directory! The database file includes also all the mysql configuration so, the reason why your MySql doesn't start is because It doesn't find the MySql configuration schema.. \n\nHope my English is clear",
2014-10-30T16:29:25
Phoeson :

You may need to check the login accont of the service MySQL57, if the account is Network Service, you may need to add this account security permission to the parent folder of the new mysql data folder",
2017-12-17T10:35:55
yy