This should be dead simple, but I cannot get it to work for the life of me.
I'm just trying to connect remotely to my MySQL server.
connecting as
mysql -u root -h localhost -p
works fine, but trying
mysql -u root -h 'any ip address here' -p
fails with the error
ERROR 1130 (00000): Host ''xxx.xx.xxx.xxx'' is not allowed to connect to this MySQL server
In the mysql.user
table, there is exactly the same entry for user 'root' with host 'localhost' as another with host '%'.
I'm at my wits' end, and have no idea how to proceed. Any ideas are welcome.
Just use the interface provided by MySql's GUI Tool (SQLyog):
Click on User manager:
Now, if you want to grant access FOR ANY OTHER REMOTE PC, just make sure that, just like in the underneath picture, the Host field value is % (which is the wildcard)
Problem: root@localhost is unable to connect to a fresh installation of mysql-community-server on openSUSE 42.2-1.150.x86_64. Mysql refuses connections - period.
Solution:
File user.MYD has 0 size (really ?!). I copied all 3 files from another working system.
I was able to log in. Then, it was just a matter of re-applying all schema privileges. Also, if you disabled IPv6, re-enable it temporary so that root@::1 account can also work.
if you are trying to execute mysql query withouth defining connectionstring, you will get this error.
Probably you forgat to define connection string before execution. have you check this out? (sorry for bad english)
Possibly a security precaution. You could try adding a new administrator account:
Although as Pascal and others have noted it's not a great idea to have a user with this kind of access open to any IP. If you need an administrative user, use root, and leave it on localhost. For any other action specify exactly the privileges you need and limit the accessibility of the user as Pascal has suggest below.
Edit:
From the MySQL FAQ:
The message
*Host ''xxx.xx.xxx.xxx'' is not allowed to connect to this MySQL server
is a reply from the MySQL server to the MySQL client. Notice how its returning the IP address and not the hostname.If you're trying to connect with
mysql -h<hostname> -u<somebody> -p
and it returns this message with the IP address, then the MySQL server isn't able to do a reverse lookup on the client. This is critical because thats how it maps the MySQL client to the grants.Make sure you can do an
nslookup <mysqlclient>
FROM the MySQL server. If that doesn't work, then there's no entry in the DNS server. Alternatively, you can put an entry in the MySQL server's HOSTS file (<ipaddress> <fullyqualifiedhostname> <hostname>
<- The order here might matter).An entry in my server's host file allowing a reverse lookup of the MySQL client solved this very problem.
Just perform the following steps:
1) Connect to mysql
2) Create user
3) Grant permissions
4) Flush priviledges