netserve
10-27-2004, 09:03 PM
I'm trying to get mysql connections bound for localhost to go via tcp rather than via /tmp/mysql.sock. Any ideas how to get this to happen?
(Reason is I've got rinetd redirecting 127.0.0.1 mysql traffic to a remote server so that I can keep localhost as the connection host in php. 1000's of sites using it so not easy to change to 127.0.0.1 etc)
wKkaY
10-28-2004, 02:23 AM
hmm i reckon you might have to hack libmysqlclient to do that. this is probably what you want to edit, in libmysql.c:
1760 /*
1761 ** Grab a socket and connect it to the server
1762 */
1763
1764 #if defined(HAVE_SYS_UN_H)
1765 if ((!host || !strcmp(host,LOCAL_HOST)) && (unix_socket || mysql_unix_port))
1766 {
netserve
10-28-2004, 11:10 AM
Brilliant, thanks. We're not far off getting that working.
A-Wing
11-06-2004, 05:57 AM
Many thanks wKkay,
I am John's sysop, I created a patch based on your post and it works beautifully.
If anyone else wants the patch I have created a .patch file a versio of MySQL 3 and am happy to create it for other versions.
The patch is at a-wing.co.uk in the downloads section (forgive the layout, I'm too busy with cluster servers to tidy it right now).
I don't know why MySQL doesn't make this at least a compile time option. I believe you can set it in the config file for PostgreSQL
wKkaY
11-06-2004, 06:23 AM
glad to help :)
just an extra note to anyone reading this thread, if this doesn't take effect, it might be because you have configured php to use its own libmysql (under ext/mysql/libmysql), as opposed to linking to (the shared) libmysql.