MySQL Forums
Forum List  »  Perl

Re: Trying to connect to mysql 5 with perl 5.8.8
Posted by: Brian
Date: February 13, 2007 04:15PM

I'm having the same problem (sort of):

I just installed ActivePerl (along with DBD:MySQL using the ppm) and MySQL on a Windows XP machine. I try testing my connection (and creating a database) with a script I developed. I run it and get the following:

I:\prophit\bin>createDB pdd
DBI connect('mysql:mysql','root',...) failed: Unknown MySQL server host 'mysql'
(11001) at I:\prophit\bin\createDb.pl line 19
Could not connect to database: Unknown MySQL server host 'mysql' (11001) at I:\p
rophit\bin\createDb.pl line 19.

During the MySQL install, I turned TCP/IP off. I ensured that both --enable-named-pipe and socket=mysql are in the my.ini file. I then put --enable-named-pipe in the startup parameters of the MySQL Windows Service and restarted it. Still getting the same error. I can connect using the MySQL command line client, but not through scripts. Any suggestions? Here is the section of the script that creates the DB:

# Connect to MySQL DB
$database = "mysql";
$dbUsername = "root";
$dbPassword = "********";
$dbHostname = "mysql";
$db = DBI->connect("DBI:mysql:$database:$dbHostname", $dbUsername, $dbPassword)
or die "Could not connect to database: " . DBI->errstr;

Options: ReplyQuote


Subject
Written By
Posted
Re: Trying to connect to mysql 5 with perl 5.8.8
February 13, 2007 04:15PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.