On 18 August 2013, Guy Ferguson <[email protected]> wrote:
[...]
> BUt I am trying to handle the chroot issue by using a hack I found online:
> 
>     ### in /etc/rc.local:
>     # mysql server
>     if [ -x /usr/local/bin/mysqld_safe ] ; then
>              su -c mysql root -c '/usr/local/bin/mysqld_safe >/dev/null
>     2>&1 &'
>              echo -n ' mysql'
> 
>              mkdir -p /var/www/var/run/mysql
>              chown www:daemon /var/www/var/run/mysql
>              # wait for a socket to appear
>              for i in 1 2 3 4 5 6; do
>                      if [ -S /var/run/mysql/mysql.sock ]; then
>                              break
>                      else
>                              sleep 1
>                              echo -n "."
>                      fi
>              done
>              ln -f /var/run/mysql/mysql.sock
>     /var/www/var/run/mysql/mysql.sock
>     fi
[...]

    You shouldn't believe everything you read, especially what you read
on Internet. :)

    Broken record: linking only works until you restart the server
manually, as mysqld removes the socket and re-creates it when starting.
The location of the socket is configured in /etc/my.cnf.  To use mysql
with chrooted Apache / Nginx either use TCP connections, or set both
/etc/my.cnf and /var/www/etc/my.cnf to point to a place inside the
chroot jail.

    On a tangentially related topic: the official way to start mysql on
5.3 is to add mysqld to pkg_scripts in /etc/rc.conf.local.  See:

        http://www.openbsd.org/faq/faq10.html#rc

    Regards,

    Liviu Daia

Reply via email to