Jump to content


Photo

MySQL Authentication Error


  • Please log in to reply
8 replies to this topic

#1 Patrick

Patrick
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 15 January 2003 - 02:47 AM

Hi, I hoping that someone will be able to help me, I\'m getting an odd error, that I can not seem to get to the bottom of. When attempting to access a list page, I get put through to the login screen and after successfully entering a valid user name and password I get put through to the page I expected, which is a list of database records. Upon clicking a link to add or edit a record I get the error below. Is anyone able to give me any ideas as to what might cause this to happen upon editing or adding a record.

The user is a root user with all privileges and both the list and edit screens have the same security restrictions. Using CodeCharge Studio, Apache 2.0.43, PHP 4.2.3, MySQL 3.23.54, with MySQL and Apache running as services on Windows 2000 where applicable. I get the same error when running from a Unix test server running similar versions.

Most appreciative if anyone could give any advice.

Patrick


ERROR
Warning: Access denied for user: \'patrick@localhost\' (Using password: YES) in /home/patrick/public_html/test/xyz.php on line x

Warning: MySQL Connection Failed: Access denied for user: \'patrick@localhost\' (Using password: YES) in /home/whitit/public_html/test/xyz.php on line x
Database error: pconnect(localhost, patrick, $Password) failed.
MySQL Error: ()
Session halted.

#2 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 15 January 2003 - 02:51 AM

run this in mysql as root to be sure:

grant all on database_name.* to patrick@localhost identified by \'your_password_here\';

you might also try quoting the arguments in pconnect.
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#3 Patrick

Patrick
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 15 January 2003 - 04:05 AM

Thanks for such a quick reply effigy, I\'ve tried both of your suggestions but so far not having any luck. The pconnect arguments are held in variables. The strange thing is that it connects for authentication, and for displaying the list, but refuses authorisation for the add/edit screen. I\'m thinking it is to do with permission settings, but I can\'t find any differences with the permissions between the pages, or any anomaly in the MySQL users database.

Any further thoughts? Any help is appreciated. Once again, thanks for your reply.

Patrick

#4 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 15 January 2003 - 04:41 AM

very odd.

you can try appending...
or die ( mysql_errno() . \' \' . mysql_error() );
...to your mysql statements to see if it returns any more specifics on the problem.

have you tried using mysql_connect() instead? something could be awry in your php.ini pconnect settings...
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#5 Patrick

Patrick
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 15 January 2003 - 09:10 AM

Thank you, I have tried both connect and pconnect with the same results, again with no luck. It has however, confirmed that it is a problem with permissions and not with the connect. I\'m racking my brains to think what is not right with the permissions - especially having used the grant statement you mentioned earlier... it is a puzzle. Any more ideas appreciated, but thank you very much for your assistance.

Patrick

#6 effigy

effigy
  • Staff Alumni
  • Advanced Member
  • 3,600 posts
  • LocationIL

Posted 15 January 2003 - 06:57 PM

this is a good one patrick — can you post or link to your php.ini and my.cnf? also, can you connect to mysql as root via the command line interface and check the grant tables?

- use mysql;
- select * from db where User=\'patrick\';
Regexp | Unicode Article | Letter Database
/\A(e)?((1)?ff(?:(?:ig)?y)?|f(?:ig)?)\z/

#7 Patrick

Patrick
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 18 January 2003 - 05:30 AM

effigy, thank you for your assistance, but I came up with a new theory... If it doesn\'t work and you can\'t fix it throw it out and start again. Might not be very good, but the problem is gone and I\'m happy. I suspect that there was a conflict with the code generator I\'m using, it\'s very powerful and I\'m still getting used to it. It turned out that the error messages were generated by Code Charge and that helped to confuse me a bit.

Thanks again,

Patrick.

#8 MrOnline

MrOnline
  • Members
  • Pip
  • Newbie
  • 3 posts

Posted 18 January 2003 - 06:10 AM

Be sure to restart mysql and possibly your webserver after making changes to users.

#9 Patrick

Patrick
  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 18 January 2003 - 11:15 AM

Thanks, some such things are very easily overlooked...




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users