When I want to create a database by through MySQL Workbench 6.1 CE the database always creates at "C:\ProgramData\MySQL\MySQL Server 5.6\data\". But I want to save it in my desired folder. How do I do that?

2 Years
Discussion Span
Last Post by Santanu Das

It happens because this is the data directory used by the server. If you want to change it then modify the datadir value in the my.cnf file, and then restart MySQL.

Note apart
I don't know how it works with Windows permissions, but in linux the new data directory must be owned by the same user running the MySQL server (usually mysql) with write, read and execution permissions for the owner, and only read and execution permissions for groups and other users.

Edited by cereal


I try it. At Options File -> General Tab I change the DataDir Path, But didn't work.


actually it is caused of MySQL always save the database in the default folder and as far as I know we can change it if we change the configuration file. I have done it before but I don't remember the file name.
Try to find the file usually with .ini or with .conf extension under MySQL folder. it is a text file remember use notepad or vi to edit this file and again remember to bacup this file before you start to edit. find the line with contain ...\data and change it to the folder that you want.
But be carefull, use this precaution:
1. backup your data first
2. copy the data to your folder
3. backup the configuration file before you start
4. edit it with notepad or vi, don't use any word processor program
5. restart MySQLafter finishing

hope this help


I already tried them as you say. Didn't get my deesired result. Result was as usual as previous.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.