Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Are any of you pair.com users? I am having problems getting my site moved over to them as I'm used to using Cpanel. I created a database and it gave me the login information for it.

This is the connection code I've always used in the past and it works, but it won't here. They did tell me a server address though but from my original code, I don't know where to include it.

use DBI; ################### # configurations ################### my $dbase = "111"; my $mysql_user = "222"; my $mysql_pass = "333"; ################### print header; my $dbh = DBI->connect("DBI:mysql:$dbase", $mysql_user, $mysql_pass) o +r print DBI->errstr; print "We are connected.<br>";
It said Database Server: db71b.pair.com. This is probably why it's not connecting. Can someone help me add that to the code or is anyone familiar with how to use their databases?

By the way, I did send them an email but it'll be a couple days until they get back to me probably.

I appreciate any help at all that you can give me.

Replies are listed 'Best First'.
Re: How to connect to MySQL on pair.com
by sh1tn (Priest) on Sep 15, 2005 at 23:26 UTC
    my $hostname = 'db71b.pair.com'; my $dbase = '111'; my $mysql_user = '222'; my $mysql_pass = '333'; my $dbh = DBI->connect( "DBI:mysql:$dbase:$hostname", $mysql_user, $mysql_pass, { RaiseError => 1, AutoCommit => 0 } ) || die "DB connection failed: $DBI::errstr\n"; # DB connection is successful if we are here ...
    Update: fixed wrong usage of $host/$hostname.


      (But s/hostname/host/ in first line?)
      chas