Jump to content

Recommended Posts

SUSE 10.1
PHP Version 5.1.2
MySQL Client API version 5.0.18
Apache/2.2.0 (Linux/SUSE)

I can't get php5 to connect to mysql 5. With or without a password.

[pre]<html><body><h1>Test MySQL Database connection</h1>
<h2>
<?php
// (1)
//$mysql= new mysqli("localhost", "galewpuser", "galewppass", "galewp");
// (2)
$mysql= new mysqli("localhost", "galewpuser", "", "galewp");
printf("Error: %s\n", mysqli_connect_error());
?>
</h2>
</body></html>[/pre]

results of (1) with the correct password set with MySQL Administrator are
Error: Access denied for user 'galewpuser'@'localhost' (using password: YES)

results of (2) with password set to "" are
Error: Access denied for user ''@'localhost' to database 'galewp'

all privs are granted between galewpuser and the galewp database
no other privs are granted between galewpuser and any other catalogs.

I had this working on WinXP with php4 and mysql4 and had to use OLD_PASSWORDS to make it work. I thought that OLD_PASSWORDS were history in these "5" days.

see phpinfo attachement

Thanks,
ww



[attachment deleted by admin]
Link to comment
https://forums.phpfreaks.com/topic/13571-access-denied-nightmare-suse-101/
Share on other sites

ok. Thanks for confirming that OLD_PASSWORDs are history.

This seems fairly straightforward. Nothing fancy. Just Apache2, mysql5 and php5...
Is there a FAQ somewhere of bonehead things to check?
I've checked everything that I know of from my previous experience on WinXP with A2,M4,P4 that worked fine.
Thanks,
ww
And the answer is that you have to add @localhost to the list of hosts explicitly @%, which is a wildcard and you would think would include localhost, apparently does not.
[list]
[*]
So, under the username in MyAdmin / Users panel, select the user you want to change, right click  and choose [b]Add Host.[/b]
[*]Then choose [b]Localhost[/b]
[*]then be sure and update the privs to include all the privs for the desired database's.
[/list]

hummm.....
Yep, you would think that WILDCARD meant WILDCARD including LOCALHOST but it apparently does not.

sigh.

ww
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.