Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

database not running

Status
Not open for further replies.

dontu

Programmer
Mar 17, 2006
14
RO
I have a problem with connected at database,no running,
MySql is runnig, tables and field is create but i do perl nameprogram.pl it say :

DBI: connect('gigi',user'...)failer:Access denied for user 'user'@'localhost'(using password:YES) at perl-bigin.pl line 6
Eroare (1045): Access denied for user 'user'@localhost'(using password:YES)


This is my program

use DBI;

$user ="gigi";
$driver = "DBI:mysql:gigi";

$dbh =DBI->connect($driver, $user) or die "\n Eroare ($DBI::err): $DBI::errstr\n";

$first = "alina";
$second = "unu";

$statement = $dbh->prepare("select $first, $second from user") or die "\n Eroare ($DBI::err):$DBI::errstr\n";

$statement->execute or die "\n Eroare ($DBI::err): $DBI::errstr\n";

print "\n \n Returnare $first si $second \n";

while(($firstname, $lastname) = $statement->fetchrow_array){
print "$alina\n $unu\n";

}

$statement->finish;

$dbh->disconnect;

Regards
Dontu,
 
You're not sending the password, have another look at the DBI documentation ;-)

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
No, because I try sending the password and no running...
 
Code:
$db="DBI:mysql:gigi:localhost";
$username="gigi";
$password="password";
      
my $dbh = DBI->connect($db, $username, $password) or die "Couldn't connect to database: " . DBI->errstr;
my $sth= $dbh->prepare('select * from table where id=?');

I've stripped this from a working script on my server
HTH

Paul
------------------------------------
Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
thank you Paul, running ,thank you congratulations


Regards
Dontu
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top