[EN] New IPv6 features with MySQL 5.6

MySQL 5.6 was released a few days ago on 5th of February 2013 and offers some quite exciting improvements. With that I do not mean the performance things everyone mentions. Nor I mean the new memcached Interface. For our company (an internet hosting company) there is small, but important improvement: There are native SQL functions to store (and work with) IPv6 addresses in an efficient manner!

You may already know INET_ATON, INET_NTOA to store v4 addresses (you want to use INT UNSIGNED or VARBINARY(4) for that). With Version 5.6 you have fully compatible ones for v6 too: INET6_NTOA, INET6_ATON and some goodies like IS_IPV4() and IS_IPV6. You can find a list of these functions in the official MySQL manual concealed under „Miscellaneous Functions„. For the sake of completeness I have to mention that you should use VARBINARY(16) for IPv6/IPv4 mixed addresses to gain optimal efficiency in terms storage space.

As already pointed out, this is a new MySQL 5.6 feature. If you have installed a mysql-server via your package management (e.g. apt-get/dpkg) you probably have installed MySQL 5.5. For those who don’t have the possibility to upgrade, take a look at the watchmouse blog, they already realized an analoge behavior with MySQL user defined functions years ago.

You don’t have MySQL 5.6 running in production until now? Don’t worry! I believe that most current installations are „old“ as there isn’t any distribution out there at moment that delivers version 5.6 out of the box. If you plan a migration at your company, I would recommend you to visit Kristian Köhntopps talk at OSDC 2013. For those who can’t wait, I have also written a blog post about how to install MySQL 5.6 on Ubuntu 12.04.

Schreibe einen Kommentar

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *