For MySQL it's a best practice to store IP addresses in a INT
column rather than in a VARCHAR. This allows for more compact
storage. This best practice is only for MySQL as PostgreSQL does
have data types like inet and cidr.
MySQL is equiped with the INET_ATON() and INET_NTOA() functions since version 3.23.15. In MySQL 5.6.3 the INET6_ATON() and INET6_NTOA() functions were addes to finaly add IPv6 address support. To make it easier to work with IPv4 and IPv6 addresses the IS_IPV4_COMPAT(), IS_IPV4_MAPPED(), IS_IPV4() and …