#1130 - Host ‘localhost’ is not allowed to connect to this MySQL server

107,783

Use the IP instead:

DROP USER 'root'@'127.0.0.1'; GRANT ALL PRIVILEGES ON . TO 'root'@'%';

For more possibilities, see this link.

To create the root user, seeing as MySQL is local & all, execute the following from the command line (Start > Run > "cmd" without quotes):

mysqladmin -u root password 'mynewpassword'

Documentation, and Lost root access in MySQL.

Share:
107,783
Steven
Author by

Steven

I'm a headhunter based in Hangzhou, China. I recruit software engineers, language experts, C-suite talents for companies. If you need my headhunting services, you can contact me via steven.tu[at]mipfanyi.com(Please replace "[at]" with "@"). If you want to get a job, you can also send a resume to my email.

Updated on February 25, 2020

Comments

  • Steven
    Steven over 4 years

    I issued a command of:

    DROP USER 'root'@'localhost'; GRANT ALL PRIVILEGES ON . TO 'root'@'%';
    

    ...in PhpMyAdmin. Immediately after the execution, I was forced out PhpMyAdmin. I got:

    error

    #1130 - Host 'localhost' is not allowed to connect to this MySQL server,

    how to resolve my problem?