Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re^2: Connect to MySQL database (on Ubuntu Server) using Perl

by liverpaul (Novice)
on Jul 25, 2012 at 12:38 UTC ( #983647=note: print w/replies, xml ) Need Help??


in reply to Re: Connect to MySQL database (on Ubuntu Server) using Perl
in thread Connect to MySQL database (on Ubuntu Server) using Perl

Hi,

Thanks for the reply. I've changed my code to this:

#!/usr/bin/perl use strict; use warnings; use DBI; my $username='username'; my $pass='password'; my $db='database_name'; my $host='hostname'; my $dbh = DBI->connect( "dbi:mysql:database=$db:$host", $username, $pa +ss, { 'PrintError' => 1, 'RaiseError' => 1 } );

I'm still getting an error: Unknown MySQL server host 'hostname' (2) at ...

Replies are listed 'Best First'.
Re^3: Connect to MySQL database (on Ubuntu Server) using Perl
by moritz (Cardinal) on Jul 25, 2012 at 12:45 UTC

      I just used hostname for my privacy. I used the real hostname in my script.

      When I was setting up my server (for my first time) I gave it a hostname (that's the name I tried in my script). I haven't done all the dns stuff yet. I've tested the site just using the ip address (I've also tested this as my hostname).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://983647]
help
Chatterbox?
[LanX]: hmm could be a myth since the root of throne is Greek
[LanX]: erix : the one armed who spent his last years in Dorn castle was a prince of Oranie ;)
[erix]: why does that tell against the Kaiser-story?
[erix]: ah, of course, makes sense
[erix]: mafia are family based, of course
[LanX]: Doorn

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (11)
As of 2017-12-15 16:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (439 votes). Check out past polls.

    Notices?