MySQL Forums
Forum List  »  Perl

DBI connect(...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
Posted by: Luca Longo
Date: October 31, 2005 02:22PM

I have tried to execute this program:
------------------------
#!/usr/bin/perl -w

use CGI;
use DBI;

#dati di accesso al db MySql
$database = "adcycle";
$user = "adcycleuser";
$pass = "testtesttest";
$driver = "DBI:mysql";

#connessione al db
my $dbh = DBI->connect("$driver:database=$database", $user, $pass) or die "Non posso connettermi!";

#Inseriamo alcuni dati nel DB
$dbh->do("show tables;");

#Disconnessione dal db
$dbh->disconnect;

exit;
---------------------

But:

adcycle@vps:~/public_html/cgi-bin$ perl test.pl
DBI connect('database=adcycle','adcycleuser',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at test.pl line 13
Error! at test.pl line 13.
adcycle@vps:~/public_html/cgi-bin$


Mysql db exist
Mysql user exist
Mysql password is exact...

if i type:
adcycle@vps:~/public_html/cgi-bin$ mysql -u adcycleuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 414 to server version: 4.1.10-standard

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> show databases;
+----------+
| Database |
+----------+
| adcycle |
+----------+
1 row in set (0.00 sec)

mysql> quit
Bye
adcycle@vps:~/public_html/cgi-bin$


Please help me... i use Debian OS.

Options: ReplyQuote


Subject
Written By
Posted
DBI connect(...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
October 31, 2005 02:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.