Skip to main content

Posts

Showing posts with the label ipv6

IPv6 on database websites

After reading www.postgresq.org now active over IPV6 by default I quickly tried some other host to see what the current state of IPv6 is for some known database websites. $ getent hosts mysql.com percona.com askmonty.org postgresql.org oracle.com sqlite.org code.openark.org skysql.com drizzle.org 156.151.63.6    mysql.com 74.121.199.234  percona.com 173.203.202.13  askmonty.org 2a02:16a8:dc51::50 postgresql.org 137.254.16.101  oracle.com 67.18.92.124    sqlite.org 69.89.31.240    code.openark.org 94.143.114.49   skysql.com 173.203.110.72  drizzle.org So only postgresql.org supports IPv6 right now. On the MySQL side Facebook is one of the known IPv6 users. Are there any IPv6  database websites I forgot to include? The World IPv6 Launch is June 6 2012, so there are still a few days left to enable IPv6!

Working with IP's in MySQL and MariaDB - Part 2

Use DNS directly from your database mysql> SELECT lookup('localhost'); +---------------------+ | lookup('localhost') | +---------------------+ | 127.0.0.1 | +---------------------+ 1 row in set (0.00 sec) mysql> SELECT reverse_lookup('127.0.0.1'); +-----------------------------+ | reverse_lookup('127.0.0.1') | +-----------------------------+ | localhost | +-----------------------------+ 1 row in set (0.00 sec) This is how you install these functions. Build udf_example.so which is in your mysql source. ( make udf_example.so ) Copy the udf_example.so file from your build directory to your plugin_dir. Create the lookup and reverse_lookup functions mysql> CREATE FUNCTION lookup RETURNS STRING SONAME 'udf_example.so'; Query OK, 0 rows affected (0.00 sec) mysql> CREATE FUNCTION reverse_lookup RETURNS STRING SONAME 'udf_example.so'; Query OK, 0 rows affected (0.00 sec) I've created a feature ...

Working with IP's in MySQL and MariaDB

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 IS_IPV6() functions were added. The difference between the new and old functions is that the old functions use INT UNSIGNED to store IP addresses and the new function uses VARBINARY(16) for IPv6 addresses and VARBINARY(4) for IPv4 addresses. Here are some examples about how you could do nifty things with IP addresses in MySQL. Store hosts and networks in MySQL CREATE TABLE `hosts` ( `id` int(10) unsigned NOT NULL AUTO_INCREMENT, `hostname` varchar(255) DEFA...