I'm migrating to new server hardware, which also means learning the idiosyncrasies of a new Linux distribution (Debian buster).
I've got a Perl CGI script which when run from the console runs, but fails to connect to MySQL with:
AH01215: DBI connect('my_db','my_db_user',...) failed: Can't connect to local MySQL server through socket '/tmp/mysql.sock'
Given it's running on the same hardware, so it'll be the same Perl install, etc. I'm at a loss as to why it's not working? I know back on Centos, SELinux could get in the way, but I don't believe Debian has this by default, but is there something similar that I'd need to do to allow child processes to make connections?
mysqladmin suggests that's the right place (i.e I'm not hitting this issue):
# mysqladmin version -p Enter password: mysqladmin Ver 8.0.17 for Linux on i686 (Source distribution) Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Server version 8.0.17 Protocol version 10 Connection Localhost via UNIX socket UNIX socket /tmp/mysql.sock Uptime: 3 days 26 min 34 sec Threads: 2 Questions: 74254 Slow queries: 0 Opens: 1042 Flush tables: 3 Open tables: 962 Queries per second avg: 0.284
And the socket clearly exists (as executing from console works)
$ ls -lF /tmp/mysql.sock srwxrwxrwx 1 mysql mysql 0 Sep 6 22:33 /tmp/mysql.sock=
/bin/false
or similar as a shell. e.g.su - www-data -s /bin/bash
. – cas Sep 9 '19 at 2:24