Granting mysql access rights to all machines on subnet

epeleg picture epeleg · Jun 19, 2011 · Viewed 16.6k times · Source

I have a mysql instance (and schema) running on windows that I can access via a connection string based on localhost as the server.

now I want to be able to access this db from another machine on the same subnet.

If possible I would like to use a single user but allow it to access from any machine on the same subnet.

how do I setup security for this? (I already opened the relevant firewall port)

Thanks, Eyal

Answer

BugFinder picture BugFinder · Jun 19, 2011

You can do it like this:

GRANT ALL PRIVILEGES ON mydb TO 'username'@'192.168.1.0/255.255.255.0';

change subnet and IP accordingly