Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I would like to move everything that is related to my current MySQL database(s) into a subdirectory of /home/mysql. I don't need to move log files or my.cnf, only data.

I don't know where the actual database files are stored and how to tell MySQL to load them from a different directory after I move them.

Can you give me some guidance?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

The data directory is specified by the datadir variable. You can check to see what the current data directory is with a:

show variables like 'datadir';

In your my.cnf under the [mysqld] section you can set:

datadir=/path/to/mysql/data

Cheers

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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