Trouble Changing Datadir Location

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I'm new to MySQL so hopefully this all makes sense.

I'm running mysql-3.23.58-14 on Fedora Core 3 and everything installs
and comes up correctly using default locations for everything.
However, I installed an 800GB RAID5 array in the server and created a
new file system on it and I attempted to move the datadir location to
the new file system and that's when the problems started.

Basically what I did was this - I shut down mysqld and copied
everything from /var/lib/mysql over to my new filesystem (/data/mysql).
 Then I checked the owner of /data/mysql and all subdirectories - its
mysql:mysql just like the original location.  I checked to make sure
the permissions were the same as the original location and they are.
Then I edited /etc/my.cnf and changed the line datadir=/data/mysql.  I
left everything else in the file as it was.  Then I tried to start
mysqld again and got the following message:

Timeout error occurred trying to start MySQL Daemon.
Starting MySQL:   [FAILED]

I checked /var/log/mysqld.log and found:

050331 00:43:17  mysqld started
/usr/libexec/mysqld: Can't change dir to '/data/mysql/' (Errcode: 13)
050331  0:43:17  Aborting

050331  0:43:17  /usr/libexec/mysqld: Shutdown Complete

050331 00:43:17  mysqld ended

I googled the errorcode and found its permission related but I've
double-checked and triple-checked the owner, group and file permissions
on the alternate datadir location and they look like they're I'm unsure on how to proceed from here.

If I switch the datadir back to its original location in /etc/my.cnf
everything starts up fine.

Any help you can offer would be greatly appreciated.


Re: Trouble Changing Datadir Location

This isn't really an answer, but it's something to try:

change to the root user, then do an 'su - mysql'.  You are now the
mysql user; try to manually change to the /data/mysql directory.  If
that is successful, and you (as the mysql user) can do an 'ls' in that
directory and see the contents, then most likely it's not really a
permissions issue (which would confirm what you already thought).

I have found that moving mysql directories was quite painful in the
past as well, as the data directory variable seems to be stored in
multiple mysql config files.  you may want to 'grep -R /var/lib/mysql
*' your mysql installation directory and see if you find other
references that need to be changed.  Finally, if all else fails, you
can simlink /var/lib/mysql to /data/mysql (ln -s /data/mysql

Good luck!
MAC wrote:
Quoted text here. Click to load it
Quoted text here. Click to load it

Site Timeline