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.

Our I.T. dept would like me to configure a MySQL server to use a non-default data dir (/data).

We're using MySQL 5.0.45-7.el5 on RHEL 5.

What is the general procedure for doing that?

Are there any caveats or gotchas I should know about before I get started?

What about RHEL's packaging system. Will it be harder to update the MySQL package if the data dir is not in its default location?

share|improve this question

1 Answer 1

up vote 3 down vote accepted

The easiest thing would be to stop mysql, move the files to the new folder and make a symlink from the default to the new folder.

If it's a separate drive you can just change the mount point to the default location as well:

Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/cciss/c0d0p2     10154020   1518184   8111716  16% /
/dev/cciss/c0d0p1       101086     15310     80557  16% /boot
tmpfs                  1037808         0   1037808   0% /dev/shm
/dev/cciss/c0d0p5    122510780  43692600  72494596  38% /var/lib/mysql

EDIT: Here's the line from my /etc/fstab

LABEL=/var/lib/mysql    /var/lib/mysql          ext3    defaults,noatime,nodiratime        1 2

You shouldn't have any trouble updating the packages either mounting at the default location, using links or changing the location in the my.cnf file.

EDIT: Here are the items that you would edit in your my.cnf:

#basedir = /var/lib/mysql
#datadir = /var/lib/mysql/data/
share|improve this answer
    
Can you still mount a volume on /var/lib/mysql if /var is a separate mounted volume? Thx -Ethan –  Agvorth Jul 6 '09 at 19:24
    
Absolutely you can. –  moshen Jul 6 '09 at 19:26

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.