How to store a 128 bit number in a single column in MySQL?
问题 I'm changing some tables to store IP addresses as numbers rather than strings. This is simple with IPv4 where the 32 bit address can fit into an integer column. However, an IPv6 address is 128 bits. The MySQL documentation only shows numeric types up to 64 bits ("bigint"). Should I stick with char/varchar for IPv6? (Ideally I'd like to use the same column for IPv4 and IPv6, so I'd prefer not to do this). Is there anything better than using two bigint columns? I would prefer not to have to