授予从任何 IP 地址远程访问 MySQL 数据库的权限

2021-11-20 00:00:00 mysql grant

我知道这个命令:

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

但是它只允许我授予一个特定的 IP 地址来访问这个远程 MySQL 数据库.如果我想要它以便任何远程主机都可以访问这个 MySQL 数据库怎么办?我怎么做?基本上,我将这个数据库公开,以便每个人都可以访问它.

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.

推荐答案

TO 'user'@'%'

% 是通配符 - 如果需要,您还可以执行 '%.domain.com''%.123.123.123' 以及类似的操作.

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

相关文章