Can't connect to local MySQL server

Web hosting discussion, programming, and shared and dedicated servers.
15 posts Page 1 of 2
by jond » Wed Aug 03, 2011 12:06 pm
First time trying to connect to sonic mysql database via perl application. Getting this error:

db_manager.cgi: DBI connect('jond_winery.db.sonic.net','',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /home/WWW_pages/jond/sevenhawkswinery.com/db_manager.cgi line 51

Line 51 is of course the open (connect) command from perl, which I normally use on other systems but substituting the host name for the sonic database, with or without username and password, but to no avail.

Hope someone can help, thanks, jon
by williamt » Wed Aug 03, 2011 12:30 pm
Is this from your website running on sonics webcluster or are you trying this from somewhere else?
Sr. Systems Administrator @ sonic.net
by jond » Wed Aug 03, 2011 12:36 pm
Running from website (sevenhawkswinery.com) hosted on sonic.net - that's part of 'sonics webcluster', right?
by jond » Wed Aug 03, 2011 2:17 pm
Ok, put more directly, here is the code (with sonic data) producing the error, which normally works on other mysql servers I use:

use DBI;
use DBD::mysql;
DBI->connect( DBI:mysql:jond_winery.db.sonic.net, "jond_winery-all", "882b1d95", { RaiseError => 1 });

Thanks :)
by williamt » Wed Aug 03, 2011 2:56 pm
It looks like the hostname is suppose to be jond-winery.db.sonic.net not jond_winery.db.sonic.net
Sorry I didn't catch that earlier.

Hope this helps.

-William
Sr. Systems Administrator @ sonic.net
by jond » Wed Aug 03, 2011 3:15 pm
thanks william for the heads-up, yes, correct spelling should help! But in this case, the connection still fails:

[Wed Aug 3 15:10:12 2011] db_manager.cgi: DBI connect('jond-winery.db.sonic.net','jond_winery-all',...) failed: Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2) at /home/WWW_pages/jond/sevenhawkswinery.com/db_manager.cgi line 50

It is interesting though, that my db table is named jond_winery, but the hostname ends up with a dash instead of an underscore.

Thanks :)
by williamt » Wed Aug 03, 2011 3:27 pm
Does it fail if you uncomment line 50 that has the username/password and comment out line 51?
Sr. Systems Administrator @ sonic.net
by williamt » Wed Aug 03, 2011 3:29 pm
Also I think you may be using the wrong password.
Sr. Systems Administrator @ sonic.net
by jond » Wed Aug 03, 2011 4:14 pm
Yes, still same error with username/password - and the same password for jond_winery-all gets me into phpMyAdmin. But, that's the correct username to use from a program right?

Thanks for checking into it :)
by augie » Wed Aug 03, 2011 5:02 pm
jond wrote: It is interesting though, that my db table is named jond_winery, but the hostname ends up with a dash instead of an underscore.
Underscores are not valid for host names:

http://domainkeys.sourceforge.net/underscore.html
15 posts Page 1 of 2

Who is online

In total there are 50 users online :: 0 registered, 0 hidden and 50 guests (based on users active over the past 5 minutes)
Most users ever online was 999 on Mon May 10, 2021 1:02 am

Users browsing this forum: No registered users and 50 guests