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 :-)
In reply to Connect to MySQL database (on Ubuntu Server) using Perl by liverpaul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |