1 message in com.mysql.lists.win32Re: Con't Connect via CGI| From | Sent On | Attachments |
|---|---|---|
| Chuck O'Donnell | 04 Apr 2002 07:34 |
| Subject: | Re: Con't Connect via CGI![]() |
|---|---|
| From: | Chuck O'Donnell (ca...@bus.net) |
| Date: | 04/04/2002 07:34:42 AM |
| List: | com.mysql.lists.win32 |
On Thu, Apr 04, 2002 at 10:03:07AM -0500, Jason Vincent wrote:
Hello there,
Not sure what part of the equation is responsible for the problem, but here it is...
The problem is, when I run my PERL script (see below) from a browser that trys to connect to a MySQL database via DBI (DBD-MySQL), the CGI can not connect to the database. However, if I run the script from the command line, it connects just fine. If I run the same script and connect to a MS Access database it connects just fine. Any ideas? Here are the details of my setup...
Question - in the .ini file, why am I specifying a user and password - what happens if I don't?
win2000 Active Perl 5.6.1 mySQL 3.23.49-nt vqServer
i don't use windows, but it sounds like a permissions problem. the web server is most likely running as a different user than you are when logged in. you need to do something like supply a username/password to connect()
also, your error print statement is probably not giving you any info. ``$!'' is the perl error string. you need to use DBI's error string, ``$DBI::errstr'', e.g.,
my $dbh = DBI->connect("dbi:mysql:$hostname:$database", $user, $pass) || print "connect failed: $DBI::errstr\n";
you'll probably see an error with the username that the server is running under being denied access.
good luck.
chuck




