perl DBI cannot connect to host=hhhh
[email protected] (Dennis German) Sat, 31 Aug 2024 21:24:51 -0400
| Newsgroups | perl.dbi.users |
|---|---|
| Message-ID | <[email protected]> |
--------------6OCuyleNsQFJX0l6hNPTka3f
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
How can DBI use a database SERVER not a socket?
1) perl code segment
$host="sdb-74.hosting.stackcp.net"; #actually not used
$database="realger1_birding"; $user='realger1_observr'; $pass='birxxx';
use DBI;
use DBD::mysql;
my $dbh = DBI->connect("DBI:mysql:$database",$user, $pass );
if ( ! $dbh ) { die "-- Failed to connect to MySQL
database:DBI->errstr()"; }
2) ERROR
DBI connect('realger1_birding','realger1_observr',...) failed: Can't
connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'
(2 "No such file or directory") at ./history.pl line 25.
3) cat ~/.my.cnf #only used by MySQL programs anyway
[mysql]
host=sdb-74.hosting.stackcp.net
4) platform:
uname -a
Linux ssh5.dfw.stackcp.net 3.10.0-1160.114.2.el7.x86_64 #1 SMP Wed Mar
20 15:54:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
5) perl -MDBI -e 'DBI->installed_versions'
Perl : 5.016003 (x86_64-linux-thread-multi)
OS : linux (3.10.0-957.1.3.el7.x86_64)
DBI : 1.627
DBD::mysql : 4.023
DBD::Sponge : 12.010002
DBD::Proxy : 0.2004
DBD::Gofer : 0.015326
DBD::File : 0.41
DBD::ExampleP : 12.014310
DBD::DBM : 0.08
--------------6OCuyleNsQFJX0l6hNPTka3f
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: 8bit
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>How can DBI use a database SERVER not a socket?<br>
</p>
<p>1) perl code segment</p>
<p><font face="monospace" size="4">$host="sdb-74.hosting.stackcp.net";
#actually not used</font></p>
<p><font face="monospace" size="4">$database="realger1_birding";
$user='realger1_observr'; $pass='birxxx';<br>
use DBI; <br>
use DBD::mysql; <br>
<br>
my $dbh = DBI->connect("DBI:mysql:$database",$user, $pass );<br>
if ( ! $dbh ) { die "-- Failed to connect to MySQL
database:DBI->errstr()"; }</font></p>
<p>2) ERROR</p>
<p><font face="monospace" size="4">DBI
connect('realger1_birding','realger1_observr',...) failed: Can't
connect to local MySQL server through socket
'/var/lib/mysql/mysql.sock' (2 "No such file or directory") at
./history.pl line 25.</font><font size="4"><br>
</font></p>
<p>3) <font face="monospace">cat ~/.my.cnf #only used by MySQL
programs anyway<br>
[mysql]<br>
host=sdb-74.hosting.stackcp.net</font></p>
<p>4) platform: <br>
</p>
<p><font face="monospace" size="4">uname -a<br>
Linux ssh5.dfw.stackcp.net 3.10.0-1160.114.2.el7.x86_64 #1 SMP
Wed Mar 20 15:54:52 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux</font></p>
<p>5) perl -MDBI -e 'DBI->installed_versions'<br>
Perl : 5.016003 (x86_64-linux-thread-multi)<br>
OS : linux (3.10.0-957.1.3.el7.x86_64)<br>
DBI : 1.627<br>
DBD::mysql : 4.023<br>
DBD::Sponge : 12.010002<br>
DBD::Proxy : 0.2004<br>
DBD::Gofer : 0.015326<br>
DBD::File : 0.41<br>
DBD::ExampleP : 12.014310<br>
DBD::DBM : 0.08<br>
<br>
</p>
<p></p>
</body>
</html>
--------------6OCuyleNsQFJX0l6hNPTka3f--