I created a user in phpMyAdmin and I only want to allow query, insert and update operations, and in my php file I am trying to connect to the MySQL database but always get the error Warning: mysqli::mysqli(): (HY000/1045): Access denied for user 'me'@'localhost' (using password: YES)
, even though I entered the parameter to the mysqli constructor correctly. I read that I should tick the GRANT
checkbox for the user however that didn't fix it. What am I missing here? Knowing that if I try it using root and no password I can connect successfully.
Asked
Active
Viewed 2,068 times
0

hakuna matata
- 101
- 1
-
Can you post the output of the following, censoring any data that you wouldn't want on the web? `select User, Host, Password from mysql.user where User = "[THE USERNAME]"` and `select User, Db, Host from mysql.db where User = "[THE USERNAME]"` – Charles D Pantoga Mar 10 '17 at 21:32
-
The first query returned `balsam % *E265936FB20A66C5498CCD3F2002B95CC0E4E561 ` and the second query returned `balsam balsam %`. The username and database name are the same. – hakuna matata Mar 11 '17 at 20:07
-
Please do not post the encrypted passwords.. I asked you to edit it. – Charles D Pantoga Mar 12 '17 at 04:14
1 Answers
0
In a comment, I asked you to run the following queries to diagnose your issue:
select User, Host, Password
from mysql.user
where User = "[The Username]";
select User, Db, Host
from mysql.db
where User = "[The Username]"
Your answer suggests the user you created is balsam
. This makes your issue very obvious -- you're attempting to connect to MySQL as user me
, please use the correct username balsam
.
Also, to make sure you're using the correct password you can run the following command:
select PASSWORD("[INSERT HASHED PASSWORD HERE]"), Password
from mysql.user
where user = 'balsam';
If running the previous commands yields the same value for both columns, you're using the correct password. If they aren't the same you'll need to either reset the password or delete the user grants and recreate the user account.
Make sure you're using the correct username, and not "me" as you posted in your question.

Charles D Pantoga
- 161
- 5
-
I ran the query for the passwords and I inserted the password for the user `balsam`, but the result was different passwords. – hakuna matata Mar 13 '17 at 18:03
-
After seeing the passwords are different, I ran an update statement changing the password of the user `balsam` to what I want it, and in my php application I am using `balsam` instead of `me`, but still I get the same error – hakuna matata Mar 13 '17 at 18:13