Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL Host '::1' or '127.0.0.1' is not allowed to connect to this MySQL server

Tags:

mysql

I have a strange issue on a web server (Windows Server 2012) with MySQL 5.7.16. I can't connect anymore to mysql server, I don't know why.

If I type mysql -uroot -ppassword appear an error

ERROR 1130 <HY000>: Host '::1' is not allowed to connect to this MySQL server or
ERROR 1130 <HY000>: Host '127.0.0.1' is not allowed to connect to this MySQL server

I tried to use another user with all privileges and I've seen that in host there is only localhost (not 127.0.0.1 or ::1)

How can I login with root@localhost and not with [email protected]? It's very frustrating... Every account trying to use @127.0.0.1 or @::1 but there exist only localhost in host and I can't change it.

If I type mysql -uroot -ppassword I see
ERROR 1130 <HY000>: Host '127.0.0.1' is not allowed to connect to this MySQL server

Same if I type mysql -uroot -ppassword -h localhost or anything else

like image 638
9overflow Avatar asked Jul 02 '17 13:07

9overflow


2 Answers

Ok i Fixed...

I've comment "skip_name_resolve" in my.ini and everything is back to work.. i really don't know why because this record was in my.ini also yesterday..last week.. last month..

like image 94
9overflow Avatar answered Oct 20 '22 22:10

9overflow


I had the same message after a fresh installation with the no-install zip and solved it as follows. Perhaps this could have been a solution for your problem too:

  1. Stop the MySQL server or service.
  2. Open a Command Prompt window with administrative rights and go to the bin folder in the MySQL install directory.
  3. Start MySQL with skip-grants-table and don't forget your config file:

mysqld --defaults-file=[filename] --skip-grant-tables

  1. Open another Command Prompt window and go to the bin folder again.
  2. Now you can login:

mysql -u root -p

  1. Show the users with:

SELECT user, host FROM mysql.user;

  1. Verify there is one 'root' with host 'localhost'.
  2. Change the host:

UPDATE mysql.user SET host='%' WHERE user='root';

  1. Exit the mysql program and close the Command Prompt window.
  2. Type Ctrl-C in the other Command Prompt window to stop the server, then close the Command Prompt Window.
  3. Start MySQL as you normally would and verify that you can login.
like image 21
Joep Avatar answered Oct 21 '22 00:10

Joep