Jump to content

Archived

This topic is now archived and is closed to further replies.

Patrick

MySQL Authentication Error

Recommended Posts

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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...

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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\';

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.