Changing MySQL data path?

Associate
Joined
10 Dec 2008
Posts
510
Location
127.0.0.1:80
To change the location that database data is stored in MySQL do I need to create my.conf and then edit it or can MySQL be told to store the data somewhere else by another method?
 
If you've looking to move the data folder and files elsewhere then its as simple as:

  1. stop mysql
  2. edit my.cnf with new data dir location
  3. copy the data files to the new location
  4. start mysql
 
What if I can't find my.cnf? I've looked in all the suggested directories, I can only imagine it either doesn't exist of the guy who installed MySQL had it in another location.
 
If I do create a new my.cnf, how will MySQL know to look for it?

I have some copies of my.cnf-small, large etc that came with the MySQL 5 installation, I take it that just taking the size off of the end and editing my own details into these configuration files would work?
 
MySQL looks for the my.cnf in /etc by default. So if its there it will use it.

Yes renaming one of the preconfigured ones will work.
 
Back
Top Bottom