On Sun, 28 Apr 2013 15:30:05 -1000
syed khalid <[email protected]> wrote:
> 2.The code that is failing on the install is this.....
>
> #*----------------------------
> -----------------------------
> #*- Create a database after checking if it exists
> #*---------------------------------------------------------
> sub create_db
> {
> my ($dbname, $userid, $pass) = @_;
>
> #*-- check for a duplicate db
> ----->> my $dbh =
> DBI->connect("DBI:mysql:mysql:localhost:3306","$userid","$pass");
> my @dbs = $dbh->func('_ListDBs');
> foreach my $db (@dbs)
> { if ($db eq $dbname) { $dbh->disconnect(); return(); } }
>
> #*-- create the db
> $dbh->do("create database $dbname"); $dbh->disconnect();
> return();
> }
>
> The error I am getting is this Line 138 refers to the ---------> line
> above)
>
>
> DBI connect('mysql:localhost:3306'
> ,'root',...) failed: Access
> denied
> for user 'root'@'localhost' (using password: NO) at ../TextMine/DbCall.pm
> line 138
^^^^^^^^^^^^^^^^^^
This means you didn't give a password. I can see that you do pass
"$pass" to the DBI->connect() call above, so it must be that $pass is
being passed a blank value when your sub create_db() is called. You
should look at the code that calls that function to find why it passes
a blank value.
--
C. Chad Wallace, B.Sc.
The Lodging Company
http://www.lodgingcompany.com/
OpenPGP Public Key ID: 0x262208A0