Jump to content

Recommended Posts

Posted

I've tried this:

 

$dbh = DBI->connect("DBI:mysql:kymercer_obits:[dbserver]", [user], undef, undef);

 

I've put various things in for dbserver and user, but keep getting messages like this:

 

Access denied for user 'kymercer'@'localhost' (using password: NO)

 

 

In the above example, I'd put 'kymercer' in for user, and 'localhost' as the server.

 

What should I put here to get it to connect? Any help appreciated.

Posted

Try this:

 

#!/usr/bin/perl

use strict;
use DBI;

my $host = "localhost";
my $database = "database1";
my $port = 3307;
my $tablename = "table1";
my $user = "userName";
my $pw = "pass";

my $dbh = DBI->connect("DBI:mysql:database=$database;host=$host;port=$port",$user, $pw)
 or die "Cannot connect to MySQL server\n";

 

source: http://stackoverflow.com/questions/2248665/perl-script-to-connect-to-mysql-server-port-3307

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...