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?

Recommended Answers

All 5 Replies

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.

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
ahmad

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.