hesco has asked for the wisdom of the Perl Monks concerning the following question:
How do I make DBI look at the right server? Does it have to be rebuilt against the server? Is it possible to switch it with an argument fed to the DBI->connect() method? Is a port bound to that socket file? Is that how this works? I couldn't find a port assigned to this purpose in /etc/services. And I'm not root here. Any ideas how an unprivileged user might sort this one out, short of banging on every port to see if I can get in?
-- Hugh
UPDATE
Thank you Bart. I've tried that, although the sysadmin on this one tells me a socket connection at localhost will run w/o the network stack overhead involved in assigning a port.
Proving yet again the wisdom of my friend's sage advise to me that he never does any root work after 1am, and the wisdom of perhaps applying that to other areas of work . . .
Of course ps -aux gave me the port and socket, returning this as a part of the mysql lines: --port=3306 --socket=/var/src_apps/mysql5/mysqld.sock.
It revealed, in spite of my assumptions to the contrary, that only one server is now running, the my5 server. Even so, by adding or dropping the port from the $dsn string, I'm getting either of the following errors:
DBI connect('host=localhost;database=he_db','he_user',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /e6/run/cgi/supporters/vol.pm line 43
or
DBI connect('host=localhost;database=he_db;port=3306','he_user',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (13) at /e6/run/cgi/supporters/vol.pm line 43
as Carp fatalsToBrowser errors.
No longer stuck and confused on this one.
Oh, the wisdom one can find by the light of day:
It was as simple as appending to the end of the $dsn string, the following: ";mysql_socket=/var/src_apps/mysql5/mysqld.sock". Thanks to our sysadmin who found this documented in I believe DBD::mysql as I understood it.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Pointing DBI::DBD::mysql at right server.
by bart (Canon) on Jun 18, 2006 at 09:39 UTC |