grant remote access of MySQL database from any IP address

adit picture adit · Dec 1, 2011 · Viewed 879.4k times · Source

I am aware of this command:

GRANT ALL PRIVILEGES
ON database.*
TO 'user'@'yourremotehost'
IDENTIFIED BY 'newpassword';

But then it only allows me to grant a particular IP address to access this remote MySQL database. What if I want it so that any remote host can access this MySQL database? How do I do that? Basically I am making this database public so everyone can access it.

Answer

Ariel picture Ariel · Dec 1, 2011
TO 'user'@'%'

% is a wildcard - you can also do '%.domain.com' or '%.123.123.123' and things like that if you need.