0

I have a MySQL server and I want to enable remote access for a certain IP and localhost only. For some reason I couldn't manage to do it as it doesn't work every time I try. I typed the following command (of course user, password and db where different):

mysql> GRANT ALL ON foo.* TO bar@'192.168.0.1' IDENTIFIED BY 'PASSWORD';

I also disabled skip-networking.

What am I doing wrong then?

1

You need to change the bind-address parameter to the IP you wish to allow remote access to. However, most people just comment out the bind-address parameter in the my.cnf file to allow access from anywhere and deal with who can access the DB server with user access control. I would suggest the latter and not the former. Don't forget to restart mysql server after making changes to my.cnf for the changes to take effect.

Please refer Here for more information.

Additionally, The grant statement should have single quotes around the name as well as the host:

mysql> GRANT ALL ON foo.* TO 'bar'@'192.168.0.1' IDENTIFIED BY 'PASSWORD';

Also, don't forget to

Flush privileges;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy