You are not logged in.

#1 2008-08-31 18:12:49

thantik
Member
Registered: 2008-08-31
Posts: 5

MySQL not obeying datadir directive in my.cnf - bah!

I'm relatively new to arch linux, I've only built 2 systems so far using it.  This second system is an old piece of hardware that I'll be using as a LAMPP server and I've run into quite a delemma.  I like keeping all my HTTP docs, MySQL data, etc all in one, nice little /srv directory.

So, during setup (following the Arch Linux LAMP wiki entry), I go ahead and change the /etc/my.cnf file to read

datadir        = /srv/mysql

- ok, so far so good, right? - Wrong.

I look in the /srv/mysql directory I created and there is nothing there.  I /etc/rc.d/mysqld stop, delete the /var/lib/mysql directory, hoping I could que mysql into reinstalling the test directory into the proper place. - mysqld start, and yay, it's reinstalling the databases! - oh crap - wait.../var/lib/mysql is back with the databases in it and /srv/mysql is still EMPTY!

Argh - someone mind helping me figure this out? - I could always just leave it there, but it will drive me insane. 
Could there possibly be another location that mysql is getting its configuration file and I'm editing the wrong one?  I've done "whereis my.cnf" and it only returned one location, and that's /etc/my.cnf

Last edited by thantik (2008-08-31 18:16:21)

Offline

#2 2008-10-23 21:28:47

mmmasterluke
Member
Registered: 2007-12-07
Posts: 49

Re: MySQL not obeying datadir directive in my.cnf - bah!

I  had the exact same problem and it gave me some headache for a while. I changed datadir in my.cnf and $MYSQL_ROOT in /etc/rc.d/mysqld to a different directory but the data still kept popping in /var/lib/mysql. I saw that after it defines $MYSQLD_ROOT, /etc/rc.d/mysqld also sources /etc/conf.d/mysqld which contains another definition of the same variable. In fact, that is the ONLY thing that this file contains.

Summary:

There are currently (mysql 5.0.68-1) three places where the mysql datadir is defined:

/etc/my.cnf
/etc/rc.d/mysqld
/etc/conf.d/mysqld

Wouldn't it be simpler to have only ONE place to set this?

Offline

#3 2008-10-25 10:35:57

Dieter@be
Forum Fellow
From: Belgium
Registered: 2006-11-05
Posts: 2,001
Website

Re: MySQL not obeying datadir directive in my.cnf - bah!

mmmasterluke wrote:

Wouldn't it be simpler to have only ONE place to set this?

Good point.  I suggest you file a bugreport


< Daenyth> and he works prolifically
4 8 15 16 23 42

Offline

Board footer

Powered by FluxBB