17 messages in com.mysql.lists.perlRE: Problem connecting
FromSent OnAttachments
Héctor S. Mendoza O.16 May 2006 19:18 
Hung Tran17 May 2006 06:22 
Héctor S. Mendoza O.17 May 2006 07:01 
Patrick Galbraith17 May 2006 10:15 
Héctor S. Mendoza O.17 May 2006 10:31 
Patrick Galbraith17 May 2006 10:35 
Héctor S. Mendoza O.17 May 2006 10:42 
Héctor S. Mendoza O.17 May 2006 11:00 
Patrick Galbraith17 May 2006 11:04 
Patrick Galbraith17 May 2006 11:07 
Héctor S. Mendoza O.17 May 2006 11:23 
Patrick Galbraith17 May 2006 11:31 
Héctor S. Mendoza O.17 May 2006 11:44 
Héctor S. Mendoza O.17 May 2006 14:22 
Vladimir V. Kolpakov17 May 2006 14:48 
Héctor S. Mendoza O.17 May 2006 14:59 
Héctor S. Mendoza O.18 May 2006 07:28 
Subject:RE: Problem connecting
From:Hung Tran (HTr@btu.com)
Date:05/17/2006 06:22:05 AM
List:com.mysql.lists.perl

Héctor,

If you are using Windows you should have MySQL ODBC driver installed .

Here is an example that use for via connection.

my $dbh = DBI->connect("dbi:mysql:host=yourhostname:yourdatabase", "yourusername", "yourpassword ) or die "Can't connect to MySQL database: $DBI::errstr\n";

$sth = $dbh->prepare("INSERT INTO yourdatabase (col1,col2,col3) VALUES ('$a','$b','$c')"); $sth->execute();

-----Original Message----- From: Héctor S. Mendoza O. [mailto:hec@acorporativa.com.mx] Sent: Tuesday, May 16, 2006 10:19 PM To: pe@lists.mysql.com Subject: Problem connecting

Hello everybody!

I have a problem, I wrote a program in perl and I can't connect to the database, then I try connecting via mysql command and it works fine...

Here is the script.

$db="planos"; $host="localhost"; $userid="web"; $passwd="secret"; $connectionInfo="dbi:mysql:$db;$host"; $dbh = DBI->connect($connectionInfo,$userid,$passwd) or die print "Error connecting\n\n\n";

And I get

DBI connect('planos;localhost','web',...) failed: Access denied for user 'web'@'localhost' (using password: YES) at ./planos.pl line 25

I use:

mysql -u web -h localhost -p planos Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 38 to server version: 4.1.10a-Max-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

and I get in ok! Any ideas?

TIA

Héctor S. Mendoza Ortiz