danielhpavey.uk

MySql Import and Export Toolbox

Dump a database

mysqldump -f  -h [HOST] -u [USER] -p[PASSWORD] [DB_NAME] > db.sql

Dump a database and gzip it

mysqldump -f  -h [HOST] -u [USER] -p[PASSWORD] [DB_NAME] | gzip > db.sql.gz

Import a sql file

mysql -h [host] -u [USER] -p[PASSWORD] [DB_NAME] < db.sql

Import a gzip sql file

zcat db.sql.gz | mysql -u [USER] -p[PASSWORD] [DB_NAME]
Date: Thursday 4th June 2020