PHP inet_aton to store IP address in MySQL Database

Don’t store IP addresses in a database as a string like (192.168.10.10). That is just the human readable form of that number. You want to store it in the database as an integer. MySQL has built in functions to handle converting a dot-notation ip address to an integer equivalent. ` mysql> SELECT INET_ATON(‘192.168.0.10’) AS ipn; +————+ | ipn | +————+ | 3232235530 | +————+ mysql> SELECT INET_NTOA(3232235530) AS ipa; +————–+ | ipa | +————–+ | 192.

Weird characters after mysqldump export and import on new server

The other day I had to migrate a Wordpress database from one server to the other. I used mysqldump to export the SQL and data from the old server. Then I used this to import mysql -uusername -ppassword database < backup.sql This went fine, but I found I was seeing weird characters in the front end and through phpmysqladmin. The “Collation” on both tables seemed the same. Then I stumbled on a website that offered this change when importing