Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Connecting to MySQL Server via PHP

Status
Not open for further replies.

JRB-Bldr

Programmer
May 17, 2001
3,281
US
I have many years of development behind me with other languages and with MS SQL Server, BUT I am a total 'newbie' to PHP & MySQL - so please be patient and 'gentle'....

I have my MySQL Server set up and can access it by both PHPMyAdmin and via its 'native' GUI interface Workbench.

I can log into it with the 'root' username & associated password.
And I can use PHP to Connect to it with the 'root' username & associated password.

I then went on to add 2 new users to MySQL and I gave them Full Rights (as confirmed in both Workbench & PHPMyAdmin).

But when I attempt to Connect to the MySQL Server with those usernames, I get an error indicating that the username is not valid.
Access denied for user 'wpuser'@'localhost' (using password: YES)

Any suggestions/advice on what I need to do to correct this would be greatly appreciated.

Thanks,
JRB-Bldr

 
PHP is the code that I am using to (trying to) establish the connection.

The code works just fine with the 'root' user, but it refuses to work with the other new users that I created through the MySQL Workbench - despite those users showing that they have FULL RIGHTS.

Thanks,
JRB-Bldr
 
Make sure your users have privileges given to them for the localhost location. MYSQL is very pick when it comes to privileges from other locations.

Code:
GRANT ALL PRIVILEGES ON *.* TO 'user'@'localhost' IDENTIFIED BY 'password'

----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.

Web & Tech
 
Thank you for the reply.

Even before trying what you suggested, I discovered that, unlike most Everything/Everywhere else, the MySQL Username is Case-Sensitive.

I always handle the Password as a Case-Sensitive value, but the Username seldom is.

Once I resolved that things began working.

Apparently, at least in a Windows environment, creating new users in either the MySQL Workbench or in PHPMyAdmin with FULL RIGHTS is sufficient as long as I remember to use Case-Sensitivity for BOTH login parameters.

Thanks for your help.
JRB-Bldr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top