MySQL cross-device links and inability for PHP to connect....

Nico Meijer nico.meijer at zonnet.nl
Thu Feb 10 22:23:30 PST 2005


Hi Bryan,

> This is what my "/etc/my.cnf" looks like:

This is one of mine, working with a chroot apache:

[client]
  socket=/var/www/var/run/mysql/mysql.sock
[mysqld]
  socket=/var/www/var/run/mysql/mysql.sock
[mysqld_safe]
open-files=1000

No hocus pocus in startup scripts needed. You can add your 
skip-networking under [mysqld]. You have to create the directory first, 
of course.

> if [ X"${mysql}" == X"YES" -a -x /usr/local/bin/mysqld_safe ]; then

I believe it is Michael Lucas (and me) who dislikes this kind of 'safety 
net'. What happens if you set ${mysql} to YES and there is no 
"/usr/local/bin/mysqld_safe"? Will your system tell you anything went 
wrong?

Yes, a completely different debate. ;-)

>         # Postfix chroot Settings
>         if [ "X${postfix_flags}" != X"NO" ]; then
>                 mkdir -p /var/spool/postfix/var/run/mysql
>                 ln -f /var/run/mysql/mysql.sock
> /var/spool/postfix/var/run/mysql/mysql.sock

You need to change the path to mysql.sock here.

> Now, MySQL starts with no problems, but the console says that I have a
> cross-device link running and when I use a basic connection script
> from PHP, it says the following:
> 
> Could not connect: Can't connect to local MySQL server through socket
> '/var/run/mysql/mysql.sock' (2)

You cannot have a hard link between filesystems. Do you have a mount 
point for /var/www and/or /var/run and/or /var in /etc/fstab?

HTH... Nico


More information about the Openbsd-newbies mailing list