According to a recent book about MySQL, this is the recipe to
convert an IP address into an integer, with the purpose of using
it as server-ID.
- Take for example
10.0.159.22
- Using a calculator (!!!), convert each of the four
numbers to hexadecimal (you get
0a.00.9f.16
) - Then glue the four hexadecimal numbers together, after
removing the dots, and, again with the calculator, convert them
to decimal (
0a009f16HEX=167812886DEC
) - Use this number (167812886) as your server ID in the options file.
Brilliant, eh?
Had the authors searched the MySQL manual for "IP address", they
would have found the INET_ATON function, which can be used like
this:
select inet_aton('10.0.159.22'); …[Read more]