liverpaul has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm having trouble connecting my local Ubuntu 12.04 laptop to my remote MySQL database on my Ubuntu Server 10.04. The Perl code I am using is as follows:
#!/usr/bin/perl use strict; use warnings; use DBI; my $username='username'; my $pass='password'; my $db='database_name'; my $dbh = DBI->connect( "dbi:mysql:$db", $username, $pass, { 'PrintErr +or' => 1, 'RaiseError' => 1 } );
I have Wordpress installed on the server and it works - I can connect to the database. However, when I fill in the same details in my Perl script I get the following error:
DBI connect('database_name','username',...) failed: Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2) at .....My server is VPS hosting by the way.
Any ideas? I'm a beginner, so keep it as simple as possible :-)
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Connect to MySQL database (on Ubuntu Server) using Perl
by moritz (Cardinal) on Jul 25, 2012 at 12:23 UTC | |
by liverpaul (Novice) on Jul 25, 2012 at 12:38 UTC | |
by moritz (Cardinal) on Jul 25, 2012 at 12:45 UTC | |
by liverpaul (Novice) on Jul 25, 2012 at 12:57 UTC | |
Re: Connect to MySQL database (on Ubuntu Server) using Perl
by Anonymous Monk on Jul 25, 2012 at 12:33 UTC | |
by liverpaul (Novice) on Jul 25, 2012 at 12:58 UTC | |
by liverpaul (Novice) on Jul 25, 2012 at 20:25 UTC | |
Re: Connect to MySQL database (on Ubuntu Server) using Perl
by choroba (Cardinal) on Jul 25, 2012 at 12:25 UTC |
Back to
Seekers of Perl Wisdom