Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


Problem Connecting to MySQL Server via PHP

Problem Connecting to MySQL Server via PHP

Problem Connecting to MySQL Server via PHP

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.


RE: Problem Connecting to MySQL Server via PHP

How is PHP involved here?

RE: Problem Connecting to MySQL Server via PHP

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.


RE: Problem Connecting to MySQL Server via PHP

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.


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

RE: Problem Connecting to MySQL Server via PHP

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.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close