
hardik.mehta.b
Novice
Mar 1, 2011, 12:29 PM
Post #1 of 1
(262 views)
|
|
DBI connect failed: Can't connect to MYSQL server on 'localhost'
|
Can't Post
|
|
I am trying to run a perl script to access MySQL a using Perl command line interpreter with additional modules like DBI and DBD-mysql on windows 7. But I am getting the following error message.
DBI connect ('SEO: host=localhost', 'wdbm', ...) failed: Can't connect to MySQL server on 'localhost' (10061) at processQueue.pl line 29 Following is the script
use DBI; # MySQL CONFIG VARIABLES my($localHostname) = hostname; my($host) = "localhost"; my($database) = "SEO"; my($user) = "hardiboy"; my($pw) = 'abcd123'; my($basePath) = dirname(__FILE__); switch($localHostname) { case 'goteq.com' { $user = 'hardiboy'; $pw = 'abcd123'; } } //line 29 my($dbh) = DBI->connect("DBI:mysql:$database;host=$host", $user, $pw); One important thing to note here is that the script works absolutely fine when I run it from rackspace server but I want to run the file locally. Also I would like to know if a local script can access the MySQL database using the MYSQL config variables used when running the script from server?? In other words, can the local script access database that is on the remote server/remotely setup?? (I guess this mite be the problem but not sure). If the answer is NO then how can I access the database which is not locally setup. I would be thankful if anyone can provide me with the solution to this problem Thanks in Advance Hardy
(This post was edited by hardik.mehta.b on Mar 1, 2011, 12:30 PM)
|