List:General Discussion« Previous MessageNext Message »
From:Paul DuBois Date:September 23 1999 2:49pm
Subject:Re: Problem with Mysql Privilages
View as plain text  
At 9:01 AM -0500 9/23/99, Craig Vincent wrote:
>Our administrator just installed Mysql 3.22.25 on a Bsdi4 machine yesterday.
>
>The problem I'm currently having is that when a script is run locally on
>the server...connections to the database is fine however if run from the
>webserver (ie. someone accessing it through a perl script via WWW) the
>error.
>
>error: 'Access denied for user: 'root@localhost' (Using password: NO)'
>
>
>Now I have two questions:
>
>1)  The administrator is on a week's vacation and did not inform me of the
>password.  Is there anyway to reset the privlages without reinstalling the
>entire program again.
>
>2)  Why is MySQL thinking a 'nobody' is trying to access the server using
>root permissions?  BTW in my scripts I have the username/password
>specified as undef, undef and as said before...this works perfectly
>locally.
>
>Any help would be greatly appreciated.


If you're passing undef for the user name, the script will try to connect
as whatever user is running the script.  I assume that when you can "a
script is run locally on the server", you mean the case where you invoke
it manually from the command line?  In that case, the script sends your
name as the user name.  When the script is invoked from the Web server,
the script sends the user name of the user the server runs as.  Given
that the error message says "root", my guess is that the Web server runs
as root.  (Not a good idea, by the way.)

You could either explicitly specify your MySQL user name and password
in the script (perhaps not a good idea, although you might try it just
to see if it works, and then make them undef again), or you can tell
the script to read a MySQL option file, and store the name and password
in that file.  I usually do something like this:

# construct data source
my ($dsn) = "dbi:mysql:db_name_here";
$dsn .= ":hostname=$host_name" if $host_name;
$dsn .= ";mysql_read_default_file=/path/to/some/option/file";

# connect to server
my (%attr) = ( RaiseError => 1 );
my ($dbh) = DBI->connect ($dsn, $user_name, $password, \%attr);

--
Paul DuBois, paul@stripped
Thread
Problem with Mysql PrivilagesCraig Vincent23 Sep
  • Re: Problem with Mysql PrivilagesPaul DuBois23 Sep
  • Re: Problem with Mysql Privilagessasha23 Sep