Host 'localhost' is not allowed to connect to this MySQL server

18,384

Solution 1

I changed this:

GRANT ALL ON database.* TO user@* IDENTIFIED BY 'password';

to:

GRANT ALL ON database.* TO user IDENTIFIED BY 'password';

then it works.

Solution 2

  • Go to cmd.
  • cd to C:\wamp\bin\mysql\mysql5.5.8\bin (or wtvr path you have)
  • run mysql -uroot -p
  • GRANT ALL ON database.* TO user@* IDENTIFIED BY 'password'; For example: GRANT ALL ON mydatabase.* TO root@* IDENTIFIED BY 'secretpass';
  • FLUSH PRIVILEGES;

Setup config.inc.php from phpMyAdmin correctly (user root, password wtvr, host localhost, etc.):

$cfg['Servers'][$i]['verbose'] = 'localhost';
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['auth_type'] = 'config';
$cfg['Servers'][$i]['user'] = 'root';
$cfg['Servers'][$i]['password'] = 'secretpass';

Solution 3

Try this-

1) Go to WAMP folder on your C drive.

2) Go to alias folder and open phpmyadmin.conf file

3) Original file look like this-

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Deny from all
Allow from 127.0.0.1

Change it to-

Options Indexes FollowSymLinks MultiViews
AllowOverride all
Order Deny,Allow
Allow from all
Share:
18,384
Admin
Author by

Admin

Updated on June 17, 2022

Comments

  • Admin
    Admin almost 2 years

    I wish to install WAMP Server on my PC and then Wordpress on Apache. I successfully installed WAMP. Launched the service to realize that phpmyadmin wasn't working. I was recieving the error mentioned in the title. So i thought of resetting the root password, flushing the privileges and then creating a database(Which i could have done via phpmyadmin).

    So i reset the mysql root password. I then tried again to run phpmyadmin..DIDN'T WORK! (I did edit the config file)

    Worst part of it all is that mysql console wont work either! I get the same error!

    I am kinda new to all this...Please help1!!! :'(