On Wednesday 06 June 2001 08:53, dariofg wrote:
> Hello,
>
> I'm trying to run mysql in a chroot jail, but the server
> errors out. I've modified safe_mysqld so it would call
> MySQL with the following command:
>
> nice --5 nohup /usr/local/mysql/libexec/mysqld  --
> basedir=/ --datadir=/var --user=mysql --pid-
> file=/var/hayek.pid --skip-locking --
> chroot=/usr/local/mysql --
> language=/usr/local/mysql/share/mysql/portuguese

I would suggest setting up the jail somewhere outside the "normal" tree such 
as in /jail/mysql or somewhere else.  

> When I run safe_mysqld, the mysql daemon dies with the
> following error (log file):
>
> 010606  9:57:58  /usr/local/mysql/libexec/mysqld:
> Table 'mysql.host' doesn't exist

Test the chroot jail by making sure that the paths (and ownership!) are 
correct within the jail.  Make sure that the mysql database in in /var/mysql. 
 Make sure that MySQL has read permission at least on the directory and on 
the table.

Note that if you put the chroot jail in /usr/local/mysql and have your tables 
in /usr/local/mysql/var you'll need to make sure that /usr/local/mysql/var 
has write privilege for the mysql user.  

> How's that possible if the table's set up just fine? I
> tried copying the mysql datafile dir to the real /var
> directory and it still can't find the 'host' table.

One of the problems I had when running MySQL in a chroot jail was that the 
/etc/passwd, /etc/shadow etc. had to be correct in the jail.  However, I 
don't think I am running it in the same configuration that you use.  See 
below.

> Has anyone got mysql running with the chroot option?
> There really should be a tutorial for this!

I do not run MySQL using its chroot option.  I actually build the jail with 
the executable and libraries in it (more portable that way).  Then, I start 
the executable from outside the jail with a modified (still haven't gotten it 
quite right yet) safe_mysqld that calls:

nohup ... chroot /jail/mysql /usr/sbin/mysqld ...

I am working on SuSE, so MySQL lives in a different place than you have it 
installed.  It was difficult to figure out the library dependencies, but 
after a little careful use of ldd, I figured it out.  The libraries depend on 
the distribution you use.

You might find this link useful, the author chroots a whole web set up with 
Apache, mod_perl, etc.  It was quite informative.  There is a brief section 
on MySQL, but he doesn't show how to install it in a chroot dir.

http://penguin.epfl.ch/chroot.html

Best,
Kyle

---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to