Click to See Complete Forum and Search --> : Mysql installation


kavis_bs79
05-13-2008, 12:31 AM
I installed mysql in my machine and tried to connect by using perl script which shows empty screen. The below is the sample script

#!c:/Perl/bin/perl.exe
print "Content-type: text/html\n\n";

use strict;
use DBI;
my $driver = "mysql";
my $server = "localhost";
my $database = "test";
my $url = "DBI:$driver:$database:$server";
my $user = "root";
my $password = "newpass";
DBI->connect( $url, $user, $password ) or die "Failure!\n";
print "Success!\n";


can anybody help me out.

Sixtease
05-14-2008, 12:36 AM
I don't know why it fails (not being very experienced with databases) but I guess you're getting an empty screen because the "Failure!\n" string is sent to STDERR. Replace the die "Failure!\n"; command with print("Failure\n"), die; or use CGI::Carp qw(fatalsToBrowser); at the beginning of the script.

bluestartech
05-20-2008, 11:08 AM
The sytax for the url string should be as follows:
$url = "dbi:mysql:$database_name@$hostname:$port"