You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To optimize the storage of an IP address (v4 or v6) in a MySQL database consider using VARBINARY data type for the ip storage field as it uses less storage space by storing byte strings rather than character strings. In this article we look at ways to convert a string IP address into its corresponding binary representation that is database storage-ready.
INSERT INTO user_ip (ip) VALUES (INET6_ATON('127.0.0.1'))
SELECT*FROM user_ip WHERE ip = INET6_ATON('127.0.0.1')
The string types are CHAR, VARCHAR, BINARY, VARBINARY, BLOB, TEXT, ENUM, and SET.
varbinary(16)
for storing IPv4/v6 addresseshttps://www.designcise.com/web/tutorial/whats-the-best-way-to-store-an-ip-address-in-mysql
The text was updated successfully, but these errors were encountered: