0

I am trying to log in using PHP and using PHPMyAdmin, but I can only log in using my root account. It doesn't matter what permissions the other account has, I just cannot log in to it, even if it has all the permissions. I am using Apache24 as web server.

Error message:

mysqli_real_connect(): (HY000/1045): Access denied for user 'noah'@'localhost' (using password: YES)

I have tried so many of the solutions I could find on Google, but not a single one is relevant to my situation, not did it help solve anything.

I have not edited any configuration files, except my PHP files to include all the extensions in there. So I already have mysqli there too.

Note: I also get the following error at the same time on the same screen: PHP was built without openssl extension, can't send password encrypted

4 Answers4

0

I had this problem too and searched the internet for a whole day till I found a solution. To connect from localhost you have to set the computer name to localhost instead of % when you create a new account in phpmyadmin. So you will have 2 users with the same name but different computer name.

EDIT: Here is a picture what should you have. Also make sure if you want to use password protection that config.inc.php has $cfg['Servers'][$i]['auth_type'] = 'cookie';

Image of phpMyAdmin

M4ST3RX
  • 23
  • 7
0

Be aware that if you are accessing from your machine you need an user 'user'@'localhost' while to access from external network you need a user 'user'@'%'

root has both access enabled by default, can it be your problem?

truffolone
  • 494
  • 4
  • 7
  • I cannot make a % when there's already a localhost and the other way around. – Noah Verkaik Oct 04 '18 at 16:05
  • Yes you can. you create a duplicate of the localhost user with the '%' host. May I ask you what is your MySQL version? are you using something like MariaDB? (It shouldn't matter but better be safe) – truffolone Oct 30 '18 at 14:04
0

if you try using the root credentials in your php application, does it work? Then after adding the permissions, did you remember to run 'flush privileges'?

can you also post a copy of the mysql users table so we can see how the permissions are assigned? (just ommit the password)

0

can you try to log in to MySQL on machine from command line (such as mysql -u -p). If succeeded, please also try with -h option by using your private IP. It is important to understand if it is a '%','localhost' problem. Phpmyadmin may being use only one of them (% or localhost) which not exist in your users table for the specified user. Also please share your mysql.users table content.

skalkanci
  • 61
  • 1
  • 6