Date: Mon, 5 Mar 2007 17:31:34 +0000 (UTC) From: Duane Hill <d.hill@yournetplus.com> To: Kalashnikov Ilya <kalashnikovi@mail.ru> Cc: freebsd-questions@freebsd.org, "Dr. Jennifer Nussbaum" <bg271828@yahoo.com> Subject: Re: Starting MySQL with different database directory Message-ID: <20070305172506.B41435@duane.dbq.yournetplus.com> In-Reply-To: <1173114693.16006.18.camel@n-ss.nighterra> References: <31636.77056.qm@web53410.mail.yahoo.com> <1173114693.16006.18.camel@n-ss.nighterra>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 5 Mar 2007, Kalashnikov Ilya wrote: > On Mon, 2007-03-05 at 07:05 -0800, Dr. Jennifer Nussbaum wrote: > >> I hope this is the right place--i looked over the MySQL docs but they talk about a different startup practice than what FreeBSD uses. >> >> I have a new install of MySQL 5.1 on a FreeBSD 6.2 system. I want to have my >> MySQL data directory in a place other than /var/db/mysql. I thought i do this by >> copying the appropriate my.cnf into /etc/my.conf and adding a line like "datadir = >> /usr/local/mysql/var/" and making it readable to mysql user. But this doesnt work; >> when i restart MySQL its still using /var/db/mysql. >> >> So i looked at the mysql-server startup script in /usr/local/etc/rc.d and added to >> rc.conf "mysql_dbdir="/usr/local/mysql/var"". (I DON'T want to do it this way, >> because i really want my MySQL related configuration things in my MySQL >> configuration file, not split between there and my FreeBSD startup file. What if >> i need to start mysql in some other way? But for now im just trying to see what >> i can get to work.) This seemed to change something--mysqld had been running >> when i made this change and when I ran "mysql-server stop" it couldnt stop, >> because it was looking in /usr/local/mysql/var/foo.pid--i think this means it did >> register the change to the new directory. But i couldnt then start it, because when >> I run "mysql-server start" i get a "Can't connect to local MySQL server through >> socket '/tmp/mysql.sock'" error. >> >> What's the right way to do this? Again id really prefer to do this all through the >> my.cnf file, but this seems not to be getting read, at least for this reason. >> >> Thank you. >> >> Jen >> >> >> --------------------------------- >> Food fight? Enjoy some healthy debate >> in the Yahoo! Answers Food & Drink Q&A. >> _______________________________________________ >> freebsd-questions@freebsd.org mailing list >> http://lists.freebsd.org/mailman/listinfo/freebsd-questions >> To unsubscribe, send any mail to "freebsd-questions-unsubscribe@freebsd.org" >> > > > By default MySQL daemon run as user "mysql". If you want start/stop > mysqld then in /usr/local/etc/rc.d /mysql-server.sh replace line > mysql_user="mysql" to mysql_user="<your-account>" > and change in /etc/rc.conf mysql_dbdir="/xxx/xxx/xx" or chahge owner > for /xxx/xxx/xx to <your-account> > Needed directory structure will created. > > Before all changes stop mysqld. > Or, you could just add underneath the mysql_enable line in /etc/rc.conf: mysql_flags="--user=user-to-run-as --datadir=/path/to/the/base/dir" to /etc/rc.conf. That way you won't have to worry about possible overwriting of the startup script do to upgrades.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070305172506.B41435>