I’ve been in the process of server migration over the past few days. It’s been easy and I’ve experienced no down time thanks to Cloudflare and the fact that DNS propagation takes a while.
One of the hardest parts of migration wasn’t the site files, it was the databases! I had exported all of the databases into 1 SQL file via phpMyAdmin, but it was too large for phpMyAdmin to import so I had to find a way to get everything back where it belonged! Thankfully, MySQL makes this simpler than I’d imagined.
To import a SQL file:
- Login to the server via SSH
- Login to mysql with:
mysql -u USER -p'PASSWORD'where
USERis your MySQL user and
PASSWORDis your MySQL password.
FILENAME.SQLis the path to the SQL file you wish to import
- Hit enter, and watch it import!