Host of userhost
suggest changeThe “host” can be either a host name or an IP address. Also, it can involve wild cards.
GRANT SELECT ON db.* TO sam@'my.domain.com' IDENTIFIED BY 'foo';
Examples: Note: these usually need to be quoted
localhost -- the same machine as mysqld
'my.domain.com' -- a specific domain; this involves a lookup
'11.22.33.44' -- a specific IP address
'192.168.1.%' -- wild card for trailing part of IP address. (192.168.% and 10.% and 11.% are "internal" ip addresses.)
Prefer root@localhost so root connects only through the local socket. 127.0.0.1 is IPv4 loopback and ::1 is IPv6 loopback. MySQL treats localhost, 127.0.0.1, and ::1 as different account hosts. 0.0.0.1 is not loopback. GRANT ... IDENTIFIED BY in the example was removed in MySQL 8.0; create the user, then GRANT.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents