Possible Duplicate:
What type should I store IP addresses for MySQL?
One single datatype which can accommodate both IPv4 and IPv6 addresses. I want to store IP addresses to limit the number of profiles that a person can make from his/her machine in my website.
IPv4 addresses use 32 bits (4 bytes), IPv6 addresses use 128 bits (16 bytes). Thus, you can store their binary representation in
BINARY(16)orVARBINARY(16)fields.Also see my answer to the question IP address storing in mysql database. It also provides comments why you would choose one over the other.