Magento: Export / Import CMS pages / Static Blocks Via SSH

It’s really a tedious task when you have to copy all the cms pages/static blocks from your development server to the live server. If you are importing the whole database then you are lucky enough but if you are updating in already installed Magento server then :(, luckily you can use the following commands via SSH:

1> Export from your development server:

mysqldump -u [username] -p[password] [database] cms_page cms_page_store cms_block cms_block_store | grep INSERT | sed 's/INSERT INTO/REPLACE INTO/' > cms-export.sql

Note: Don’t forget to add a prefix to cms_* tables if you have prefixed your tables.

2> Import to your live/destination server:

mysql -u [username] -p[password] [database] < cms-export.sql

Hope this saves your time while copying cms pages & static blocks.

Let’s share if anyone has a better idea.

Happy E-Commerce!!