Importing/Exporting Magento Databases

Posted by: Karen Tuesday, August 24th, 2010

Magento Databases can get pretty big. Here are some commands to help with import/export.

Exporting:

mysqldump -h localhost -u <username> -p <dbname> > <exportname>.sql

Importing:

mysql -h localhost -u <username> -p <dbname> < <importname>.sql
e.g. mysql -h localhost -u karen -p auctionmaid < auctionmaid.sql

If you need to transfer this file off the server via the shell you can do this – see the Putty tools for downloads:

pscp <username>@<remoteip>:<fullpath_to_sql_file>.sql <local_sql_file>.sql
e.g.
pscp root@1.1.1.1:/var/www/vhosts/testsite.com/magdb.sql > magdb.sql

Comments are closed.