From sternberg at anl.gov Tue Jan 10 15:12:30 2012 From: sternberg at anl.gov (Michael Sternberg) Date: Tue, 10 Jan 2012 16:12:30 -0600 Subject: [gold-users] custom MySQL socket location - fix Message-ID: Hi there, I encountered and solved a problem for Gold when it talks to a local MySQL over a custom path to mysql.sock. I recently moved Gold and the MySQL DB that I use with it to a new pair of servers. I customized "socket=" in the MySQL config file as part of a high-availability setup. Turns out any client, such as Perl's DBI module, which uses libmysqlclient.so to connect locally to a mysqld needs to be told that path (perhaps locating and parsing my.cnf is not suitable within the library). Upon starting Gold after I moved and tested the DB itself I got this in the syslog: Jan 9 12:58:30 mgmt03 lrmd: [7319]: info: RA output: (GOLD:start:stderr) DBI connect('database=gold;host=localhost','gold',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /opt/soft/gold-2.1.11.0-4/lib/Gold/Database.pm line 165 The lazy solution is a symlink at the default location, and the canonical solution is to set an environment variable - http://dev.mysql.com/doc/refman/5.0/en/problems-with-mysql-sock.html Thus, I added to Gold's init script (in my case /etc/rc.d/init.d/gold) after the line with "LOCKFILE=..." : # read MySQL socket path for use by libmysqlclient.so (as used by perl DBI) test -f /etc/my.cnf && MYSQL_UNIX_PORT=`sed -n '/^socket=/ { s/.*=//p;q }' < /etc/my.cnf` test -n "$MYSQL_UNIX_PORT" && export MYSQL_UNIX_PORT Best, Michael