1

Well, after reading topics with the same name without success I feel forced to ask again and show you my scenario:

I am on a Kali Linux machine, my mysql config file (/etc/my.cnf) is setup this way:

bind-address = 172.16.1.228

I reset the service I can't enter neither remotely nor localy, I got this 2 errors depending on how I access:

root@Adkadon:~# mysql -u root -p -h 172.16.1.228
Enter password: 
ERROR 1130 (HY000): Host 'Adkadon' is not allowed to connect to this MySQL server

mysql -u root -p -h 127.0.0.1
Enter password: 
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (111)

Note that without the -h 127.0.0.1 I have never been allowed to access.

So, I change the my.cnf and set bind-address to 0.0.0.0.

I access this way: mysql -u root -p -h 127.0.0.1, I do the following:

GRANT ALL PRIVILEGES ON *.* TO root@172.16.1.228 BY ‘root‘ WITH GRANT OPTION;

Again change bind-address to 172.16.1.228 and no success.

This is the output of SELECT user,host FROM user; inside the database:

root             | 127.0.0.1    |
| root             | 172.1.16.228 |
| root             | ::1          |
| debian-sys-maint | localhost    |
| root             | localhost    |
| root             | repo   

I don't know what do to, any idea¿? Thank you very much

aDoN
  • 1,877
  • 4
  • 39
  • 55
  • possible duplicate of [Host 'xxx.xx.xxx.xxx' is not allowed to connect to this MySQL server](http://stackoverflow.com/questions/1559955/host-xxx-xx-xxx-xxx-is-not-allowed-to-connect-to-this-mysql-server) – TZHX Apr 16 '15 at 10:56
  • It seems you need to add / create a *new* user for that host. – TZHX Apr 16 '15 at 10:56
  • 172.16.1.228 which is this IP? Your mysql server? If so, what is the IP of the machine you are firing the command from? (I mean the IP of the host 'Adkadon') – Akhil Apr 16 '15 at 11:25

1 Answers1

2

If I guess right, 172.1.16.228 is your IP of mysql server . 'Adkadon' is the host where you try to access mysql from.

If that is the case, get the IP address of Adkadon (ifconfig)

Say if 172.1.16.xxx is your host IP, then in my.cnf mention

bind-address = 172.16.1.xxx This indicates connections are allowed only from 172.16.1.xxx

Create a user root@172.16.1.xxx

And for connecting to mysql , use command

mysql -u root -p -h 172.1.16.228

Please note, -h 172.1.16.228 indicates where to connect to, not where it is connecting from.

Does it solve your problem? Or am I missing something from your question?

Akhil
  • 2,602
  • 23
  • 36