{"id":869,"date":"2014-06-25T03:30:50","date_gmt":"2014-06-25T03:30:50","guid":{"rendered":"http:\/\/invisiblezero.net\/?p=869"},"modified":"2024-07-22T09:38:03","modified_gmt":"2024-07-22T09:38:03","slug":"magento-clean-database-dump-for-development-purpose","status":"publish","type":"post","link":"http:\/\/ndthanh.com\/magento-clean-database-dump-for-development-purpose\/","title":{"rendered":"Magento 1 – Clean database dump for development purpose"},"content":{"rendered":"

Mangeto Database is huge and complicated, everyone knows about this truth. It’s a big obstacle for many developers who start working on a new project or grab latest changes on production server. The following procedure will help you to reduce size of production database a lot before downloading to you local environment.<\/p>\n

<\/p>\n

Like usual, you will need to make a database dump first with this command :<\/p>\n

\n\nmysqldump -u[user_name] -p[password] -h[host_name] [database_name] &amp;amp;amp;gt; [path_to_dump_file].sql\n\n<\/pre>\n

Then you will need to create a new temporary database and import the database dump above. try this command in your Mysql console<\/p>\n

\n\nCREATE DATABASE [temporary_database_name] DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;\n\n<\/pre>\n

Exit mysql console then you can import database with this command in terminal :<\/p>\n

\n\nmysql -u[user_name] -p[password] -h[host_name] [temporary_database_name] &amp;amp;amp;lt; [path_to_dump_file].sql\n\n<\/pre>\n

after having database imported, log in your Mysql console again and execute this SQL script:<\/p>\n

\n\nSET FOREIGN_KEY_CHECKS=0;\n-- reset customers\nTRUNCATE customer_address_entity;\nTRUNCATE customer_address_entity_datetime;\nTRUNCATE customer_address_entity_decimal;\nTRUNCATE customer_address_entity_int;\nTRUNCATE customer_address_entity_text;\nTRUNCATE customer_address_entity_varchar;\nTRUNCATE customer_entity;\nTRUNCATE customer_entity_datetime;\nTRUNCATE customer_entity_decimal;\nTRUNCATE customer_entity_int;\nTRUNCATE customer_entity_text;\nTRUNCATE customer_entity_varchar;\nTRUNCATE log_customer;\nTRUNCATE log_visitor;\nTRUNCATE log_visitor_info;\nTRUNCATE log_url;\ntruncate log_url_info;\n\nALTER TABLE customer_address_entity AUTO_INCREMENT=1;\nALTER TABLE customer_address_entity_datetime AUTO_INCREMENT=1;\nALTER TABLE customer_address_entity_decimal AUTO_INCREMENT=1;\nALTER TABLE customer_address_entity_int AUTO_INCREMENT=1;\nALTER TABLE customer_address_entity_text AUTO_INCREMENT=1;\nALTER TABLE customer_address_entity_varchar AUTO_INCREMENT=1;\nALTER TABLE customer_entity AUTO_INCREMENT=1;\nALTER TABLE customer_entity_datetime AUTO_INCREMENT=1;\nALTER TABLE customer_entity_decimal AUTO_INCREMENT=1;\nALTER TABLE customer_entity_int AUTO_INCREMENT=1;\nALTER TABLE customer_entity_text AUTO_INCREMENT=1;\nALTER TABLE customer_entity_varchar AUTO_INCREMENT=1;\nALTER TABLE log_customer AUTO_INCREMENT=1;\nALTER TABLE log_visitor AUTO_INCREMENT=1;\nALTER TABLE log_visitor_info AUTO_INCREMENT=1;\n\nTRUNCATE sales_flat_creditmemo;\nTRUNCATE sales_flat_creditmemo_comment;\nTRUNCATE sales_flat_creditmemo_grid;\nTRUNCATE sales_flat_creditmemo_item;\nTRUNCATE sales_flat_invoice;\nTRUNCATE sales_flat_invoice_comment;\nTRUNCATE sales_flat_invoice_grid;\nTRUNCATE sales_flat_invoice_item;\nTRUNCATE sales_flat_order;\nTRUNCATE sales_flat_order_address;\nTRUNCATE sales_flat_order_grid;\nTRUNCATE sales_flat_order_item;\nTRUNCATE sales_flat_order_payment;\nTRUNCATE sales_flat_order_status_history;\nTRUNCATE sales_flat_quote;\nTRUNCATE sales_flat_quote_address;\nTRUNCATE sales_flat_quote_address_item;\nTRUNCATE sales_flat_quote_item;\nTRUNCATE sales_flat_quote_item_option;\nTRUNCATE sales_flat_quote_payment;\nTRUNCATE sales_flat_quote_shipping_rate;\nTRUNCATE sales_flat_shipment;\nTRUNCATE sales_flat_shipment_comment;\nTRUNCATE sales_flat_shipment_grid;\nTRUNCATE sales_flat_shipment_item;\nTRUNCATE sales_flat_shipment_track;\nTRUNCATE sales_invoiced_aggregated;\nTRUNCATE sales_invoiced_aggregated_order;\nTRUNCATE sales_order_aggregated_created;\nTRUNCATE sendfriend_log;\nTRUNCATE tag;\nTRUNCATE tag_relation;\nTRUNCATE tag_summary;\nTRUNCATE wishlist;\nTRUNCATE log_quote;\nTRUNCATE report_event;\nTRUNCATE report_viewed_product_index;\nTRUNCATE report_compared_product_index;\nALTER TABLE sales_flat_creditmemo AUTO_INCREMENT=1;\nALTER TABLE sales_flat_creditmemo_comment AUTO_INCREMENT=1;\nALTER TABLE sales_flat_creditmemo_grid AUTO_INCREMENT=1;\nALTER TABLE sales_flat_creditmemo_item AUTO_INCREMENT=1;\nALTER TABLE sales_flat_invoice AUTO_INCREMENT=1;\nALTER TABLE sales_flat_invoice_comment AUTO_INCREMENT=1;\nALTER TABLE sales_flat_invoice_grid AUTO_INCREMENT=1;\nALTER TABLE sales_flat_invoice_item AUTO_INCREMENT=1;\nALTER TABLE sales_flat_order AUTO_INCREMENT=1;\nALTER TABLE sales_flat_order_address AUTO_INCREMENT=1;\nALTER TABLE sales_flat_order_grid AUTO_INCREMENT=1;\nALTER TABLE sales_flat_order_item AUTO_INCREMENT=1;\nALTER TABLE sales_flat_order_payment AUTO_INCREMENT=1;\nALTER TABLE sales_flat_order_status_history AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote_address AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote_address_item AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote_item AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote_item_option AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote_payment AUTO_INCREMENT=1;\nALTER TABLE sales_flat_quote_shipping_rate AUTO_INCREMENT=1;\nALTER TABLE sales_flat_shipment AUTO_INCREMENT=1;\nALTER TABLE sales_flat_shipment_comment AUTO_INCREMENT=1;\nALTER TABLE sales_flat_shipment_grid AUTO_INCREMENT=1;\nALTER TABLE sales_flat_shipment_item AUTO_INCREMENT=1;\nALTER TABLE sales_flat_shipment_track AUTO_INCREMENT=1;\nALTER TABLE sales_invoiced_aggregated AUTO_INCREMENT=1;\nALTER TABLE sales_invoiced_aggregated_order AUTO_INCREMENT=1;\nALTER TABLE sales_order_aggregated_created AUTO_INCREMENT=1;\nALTER TABLE sendfriend_log AUTO_INCREMENT=1;\nALTER TABLE tag AUTO_INCREMENT=1;\nALTER TABLE tag_relation AUTO_INCREMENT=1;\nALTER TABLE tag_summary AUTO_INCREMENT=1;\nALTER TABLE wishlist AUTO_INCREMENT=1;\nALTER TABLE log_quote AUTO_INCREMENT=1;\nALTER TABLE report_event AUTO_INCREMENT=1;\nALTER TABLE report_viewed_product_index AUTO_INCREMENT=1;\nALTER TABLE report_compared_product_index AUTO_INCREMENT=1;\nSET FOREIGN_KEY_CHECKS=1;\n\n<\/pre>\n","protected":false},"excerpt":{"rendered":"

Mangeto Database is huge and complicated, everyone knows about this truth. It’s a big obstacle for many developers who start working on a new project or grab latest changes on production server. The following procedure will help you to reduce size of production database a lot before downloading to you local environment. Like usual, you…<\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":1483,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[44,91,45],"tags":[59,93,62,51,55],"aioseo_notices":[],"views":11,"_links":{"self":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/869"}],"collection":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/comments?post=869"}],"version-history":[{"count":5,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/869\/revisions"}],"predecessor-version":[{"id":1484,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/posts\/869\/revisions\/1484"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media\/1483"}],"wp:attachment":[{"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/media?parent=869"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/categories?post=869"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ndthanh.com\/wp-json\/wp\/v2\/tags?post=869"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}