MySQL Phrasebook

The SQL wildcard characters, % and _, can be used in the privilege system to denote that access is granted when the connection parameters match the given pattern. Most commonly, you want to allow access from a range of hosts without having to create multiple user accounts for the same person. The following statement creates a user zak that can connect from any host on the 192.168.0.x IP range.

CREATE USER 'zak'@'192.168.0.%' IDENTIFIED BY 'phrasebook';

If you are happy to rely on username/password authentication only and want to allow logins for a user from any host, simply use % for the hostname:

CREATE USER 'zak'@'%' IDENTIFIED BY 'phrasebook';

Категории