List:General Discussion« Previous MessageNext Message »
From:Thimble Smith Date:July 26 1999 10:55pm
Subject:Re: can't access mysql from web - command link ok
View as plain text  
Jerry, I can't explain why nothing changed but it's not working
anymore.  But how about if you specify the user in that call to
Connect?  It's clear from the Mysql error message that it's
trying to connect with the empty user name, not user 'jerry'.

If this script is something you want to keep up with, you might
consider using DBI instead of the old Mysql module.  You'll get
better support from this list, too, 'cause most of us don't use
Mysql.pm anymore (and it's just as hard for us to look at the
manual page as it is for you).  ;)

The next message (about Query and no package) is because your
program kept on trucking after the failed connect - you tried to
use the db connection that didn't exist.  It'd be good for your
sanity if your program checked return codes and didn't keep going
after things blow up.

Tim


At 15:29, 19990726, Jerry Preeper wrote:
>My mistake.  In the statement
>$dbh = Mysql->Connect('localhost','jerry');  # connect to db
>jerry is the database not the user.  
>I have this script as an ssi call on a web page and when I call the page, I
>get this in the error log
>Mysql's message: Access denied for user: '@localhost' to database 'jerry'
>at /usr/local/lib/perl5/site_perl/Mysql.pm line 85.
>Can't call method "Query" without a package or object reference at
>/www/mydomain/cgi-bin/scores.cgi line 106.
>
>Line 106 in the script is:
>$sql_r2 = $dbh->Query($sql_query);
>
>I don't get any error messages on the web page that calls the script.
>
>Jerry
>
>
>At 03:55 PM 7/26/99 -0600, Sasha Pachev wrote:
>>I don't see where you are selecting the database. Also make sure to
>>check for error after every Mysql call and print the error message in
>>case of failure in such a way that it will make it apparent where it
>>fails. 
>>
>>Jerry Preeper wrote:
>>> 
>>> Here are the main snippets of code from my perl program with a bunch of
>>> comments and stuff unrelated to mysql removed for brevity.  I am connecting
>>> with a localhost and user (jerry) combination that had worked fine before (
>>> I can do a show columns from the command line for the table and everything
>>> seems fine) - I haven't changed this script (or others that don't work now)
>>> since April and it was working before I noticed this problem within the
>>> last few days.
>>> 
>>> #!/usr/local/bin/perl -w
>>> use Mysql;             # this library required for Mysql
>>> print "Content-type: text/html\n\n";
>>> .. (snip)
>>> some date calculations here
>>> .. (snip)
>>> $dbh = Mysql->Connect('localhost','jerry');  # connect to db
>>> $schedule_table = "lajolla_1999";
>>> .. (snip)
>>> bunch of html page printing
>>> .. (snip)
>>> $sql_query  = "select date_format(date, '%M %d, %Y'),away,away_score,";
>>> $sql_query .= "home,home_score,";
>>> $sql_query .= "from $schedule_table ";
>>> $sql_query .= "where date >=$lastweek and date <=$yesterday ";
>>> $sql_query .= "order by date desc";
>>> $sql_r2 = $dbh->Query($sql_query);
>>> while (@game_data = $sql_r2->FetchRow()) {
>>> $date                    = $game_data[0];
>>> $away                    = $game_data[1];
>>> $away_score              = $game_data[2];
>>> $home                    = $game_data[3];
>>> $home_score              = $game_data[4];
>>> .. (snip)
>>> now print a bunch of the data above
>>> 
>>> Jerry
>>> 
>>> At 03:18 PM 7/26/99 -0600, Sasha Pachev wrote:
>>> >Stuart D Jackson wrote:
>>> >>
>>> >>         Might it have something to do with the fact that netscape
> (and
>>> >> other browsers) like to do stuff (like ftp) as anonymous instead of
> a
>>> >> regular user?
>>> >>
>>> >> -Stuart
>>> >
>>> >No, netscape has no knowledge of MySQL, and can communicate with it only
>>> >indirectly through web server applications, applets, and possibly
>>> >plug-ins that know how to talk to MySQL. Netscape itself will never send
>>> >the authentication info for MySQL connection.
>>> >
>>> >>
>>> >> On Mon, 26 Jul 1999, Jerry Preeper wrote:
>>> >>
>>> >> > This seems weird but I just noticed that the mysql daemon
> wasn't
>>> allowing a
>>> >> > connection from the web browser with the error message "Access
>denied for
>>> >> > user: '@localhost' to database..." in the error log.  However,
> when
>I run
>>> >> > mysql mysql from the command line (or for any database)
> everything
>seems
>>> >> > fine and I can run commands without a problem.  I tried
> restarting and
>>> get
>>> >> > the same problem.   I haven't changed any users or anything
> like
>that, in
>>> >> > fact I hadn't even used it in a couple of weeks.  I just
> checked the
>>> >> > version and I'm running Ver 9.27 Distrib 3.22.14b-gamma, for
>>> >> > unknown-freebsd2.2.6 (i386) on FreeBSD 2.2.8-stable (and yes
> mysql has
>>> been
>>> >> > running since after we upgraded to 2.2.8-stable).  Anyone ever
> seen
>this
>>> >> > and have any ideas on how to fix it.
>>> >> >
>>> >
>>> >Can you post the code that give you this error. It seems to me that you
>>> >are sending an empty string for the user parameter when connecting to
>>> >MySQL.
>>> >
>>> >
>>> >> > Jerry
Thread
can't access mysql from web - command link okJerry Preeper27 Jul
  • Re: can't access mysql from web - command link okStuart D Jackson27 Jul
    • Re: can't access mysql from web - command link okSasha Pachev27 Jul
      • Re: can't access mysql from web - command link okJerry Preeper27 Jul
    • Re: can't access mysql from web - command link okJerry Preeper27 Jul
    • Re: can't access mysql from web - command link okSasha Pachev27 Jul
      • Re: can't access mysql from web - command link okJerry Preeper27 Jul
        • Re: can't access mysql from web - command link okThimble Smith27 Jul
Re: can't access mysql from web - command link okHunter Hillegas27 Jul
  • Re: can't access mysql from web - command link okChristian Mack27 Jul