Using Wildcards


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'; 




MySQL Phrasebook. Essential Code and Commands
MySQL Phrasebook
ISBN: 0672328399
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net