#079: Moving the Live Database Local

(Updated on )

As we get started working in WordPress it will be best if we snag an exact copy of the live database to work with locally. Some websites have things like phpMyAdmin installed which provide a GUI for things like exporting a database, but the CSS-Tricks database is just too big for that. So instead we SSH into the site and do a mysqldump from the command line to get a copy of it. We dump it outside the web root so nobody can access it. Then we log in with FTP and download it.

I end up having to google this all the time, so I’ll just list them here:

Dumping a database

mysqldump -u username -p databasename > dumpfilename.sql

Importing a database

mysql -u username -p databasename < dumpfilename.sql