Magento2 - Remove Sample Data using Mysql ScriptInstall Sample Data on Enterprise 1.14How to delete all sample data magento 1.9Can't download sample data from ssh anymoreMagento 2 - sample data clean up scriptRemove Sample Data on M2.1CLI Sample Data installation error - Magento 2Sample data for community edition 1.8Magento 2: Error After Installing Sample Data using ComposerHow to get 10K products sample data in Magento 2?Magento 2: How to remove Category using category id by Mysql script

Sword in the Stone story where the sword was held in place by electromagnets

Touchscreen-controlled dentist office snowman collector game

What wound would be of little consequence to a biped but terrible for a quadruped?

Does splitting a potentially monolithic application into several smaller ones help prevent bugs?

Ban on all campaign finance?

Humans have energy, but not water. What happens?

Can infringement of a trademark be pursued for using a company's name in a sentence?

Why must traveling waves have the same amplitude to form a standing wave?

Can someone explain this Mudra being done by Ramakrishna Paramhansa in Samadhi?

US to Europe trip with Canada layover- is 52 minutes enough?

Is all copper pipe pretty much the same?

Do f-stop and exposure time perfectly cancel?

It's a yearly task, alright

Why don't MCU characters ever seem to have language issues?

Want to switch to tankless, but can I use my existing wiring?

How does Dispel Magic work against Stoneskin?

Is going from continuous data to categorical always wrong?

Is a lawful good "antagonist" effective?

"One can do his homework in the library"

Excess Zinc in garden soil

validation vs test vs training accuracy, which one to compare for claiming overfit?

What is the definition of "Natural Selection"?

Should we release the security issues we found in our product as CVE or we can just update those on weekly release notes?

How is the Swiss post e-voting system supposed to work, and how was it wrong?



Magento2 - Remove Sample Data using Mysql Script


Install Sample Data on Enterprise 1.14How to delete all sample data magento 1.9Can't download sample data from ssh anymoreMagento 2 - sample data clean up scriptRemove Sample Data on M2.1CLI Sample Data installation error - Magento 2Sample data for community edition 1.8Magento 2: Error After Installing Sample Data using ComposerHow to get 10K products sample data in Magento 2?Magento 2: How to remove Category using category id by Mysql script













0















Did anyone know how to remove the Sample data from Database using Mysql script, I know we can remove using CLI, But i need a script to remove in Database.










share|improve this question














bumped to the homepage by Community 1 hour ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.



















    0















    Did anyone know how to remove the Sample data from Database using Mysql script, I know we can remove using CLI, But i need a script to remove in Database.










    share|improve this question














    bumped to the homepage by Community 1 hour ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.

















      0












      0








      0








      Did anyone know how to remove the Sample data from Database using Mysql script, I know we can remove using CLI, But i need a script to remove in Database.










      share|improve this question














      Did anyone know how to remove the Sample data from Database using Mysql script, I know we can remove using CLI, But i need a script to remove in Database.







      magento2 database sample-data






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 12 '17 at 13:54







      user2520












      bumped to the homepage by Community 1 hour ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 1 hour ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.






















          1 Answer
          1






          active

          oldest

          votes


















          0














          This is what I have used to clean up test customers & orders:



          -- Magento EE 2.1.1 
          SET FOREIGN_KEY_CHECKS = 0;

          -- Clearing all orders
          TRUNCATE sales_bestsellers_aggregated_daily;
          TRUNCATE sales_bestsellers_aggregated_monthly;
          TRUNCATE sales_bestsellers_aggregated_yearly;

          TRUNCATE sales_creditmemo;
          TRUNCATE sales_creditmemo_comment;
          TRUNCATE sales_creditmemo_grid;
          TRUNCATE sales_creditmemo_item;
          TRUNCATE sales_invoice;
          TRUNCATE sales_invoice_comment;
          TRUNCATE sales_invoice_grid;
          TRUNCATE sales_invoice_item;
          TRUNCATE sales_invoiced_aggregated;
          TRUNCATE sales_invoiced_aggregated_order;
          TRUNCATE sales_order;
          TRUNCATE sales_order_address;
          TRUNCATE sales_order_aggregated_created;
          TRUNCATE sales_order_aggregated_updated;
          TRUNCATE sales_order_grid;
          TRUNCATE sales_order_item;
          TRUNCATE sales_order_payment;
          -- TRUNCATE sales_order_status;
          TRUNCATE sales_order_status_history;
          -- TRUNCATE sales_order_status_label;
          -- TRUNCATE sales_order_status_state;
          TRUNCATE sales_order_tax;
          TRUNCATE sales_order_tax_item;
          TRUNCATE sales_payment_transaction;
          TRUNCATE sales_refunded_aggregated;
          TRUNCATE sales_refunded_aggregated_order;
          -- TRUNCATE sales_sequence_meta;
          -- TRUNCATE sales_sequence_profile;
          TRUNCATE sales_shipment;
          TRUNCATE sales_shipment_comment;
          TRUNCATE sales_shipment_grid;
          TRUNCATE sales_shipment_item;
          TRUNCATE sales_shipment_track;
          TRUNCATE sales_shipping_aggregated;
          TRUNCATE sales_shipping_aggregated_order;

          TRUNCATE tax_order_aggregated_created;
          TRUNCATE tax_order_aggregated_updated;
          TRUNCATE reporting_orders;

          -- EE Only
          TRUNCATE magento_customercustomattributes_sales_flat_order;
          TRUNCATE magento_customercustomattributes_sales_flat_order_address;
          TRUNCATE magento_sales_creditmemo_grid_archive;
          TRUNCATE magento_sales_invoice_grid_archive;
          TRUNCATE magento_sales_order_grid_archive;
          TRUNCATE magento_sales_shipment_grid_archive;


          -- Clearing all cart items
          TRUNCATE quote;
          TRUNCATE quote_address;
          TRUNCATE quote_address_item;
          TRUNCATE quote_id_mask;
          TRUNCATE quote_item;
          TRUNCATE quote_item_option;
          TRUNCATE quote_payment;
          TRUNCATE quote_shipping_rate;

          -- EE Only
          TRUNCATE magento_customercustomattributes_sales_flat_quote;
          TRUNCATE magento_customercustomattributes_sales_flat_quote_address;


          -- Clearing all customers
          TRUNCATE customer_address_entity;
          TRUNCATE customer_address_entity_datetime;
          TRUNCATE customer_address_entity_decimal;
          TRUNCATE customer_address_entity_int;
          TRUNCATE customer_address_entity_text;
          TRUNCATE customer_address_entity_varchar;
          TRUNCATE customer_dummy_cl;
          -- TRUNCATE customer_eav_attribute;
          -- TRUNCATE customer_eav_attribute_website;
          TRUNCATE customer_entity;
          TRUNCATE customer_entity_datetime;
          TRUNCATE customer_entity_decimal;
          TRUNCATE customer_entity_int;
          TRUNCATE customer_entity_text;
          TRUNCATE customer_entity_varchar;
          -- TRUNCATE customer_form_attribute;
          TRUNCATE customer_grid_flat;
          -- TRUNCATE customer_group;
          TRUNCATE customer_log;
          TRUNCATE customer_visitor;
          TRUNCATE persistent_session;

          TRUNCATE wishlist;
          TRUNCATE wishlist_item;
          TRUNCATE wishlist_item_option;

          -- reviews (be careful...)

          TRUNCATE gift_message;
          TRUNCATE review;
          TRUNCATE review_detail;
          -- TRUNCATE review_entity;
          TRUNCATE review_entity_summary;
          -- TRUNCATE review_status;
          TRUNCATE review_store;

          -- Clearing log tables
          TRUNCATE magento_logging_event;
          TRUNCATE magento_logging_event_changes;

          SET FOREIGN_KEY_CHECKS = 1;





          share|improve this answer






















            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "479"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f169880%2fmagento2-remove-sample-data-using-mysql-script%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown
























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            This is what I have used to clean up test customers & orders:



            -- Magento EE 2.1.1 
            SET FOREIGN_KEY_CHECKS = 0;

            -- Clearing all orders
            TRUNCATE sales_bestsellers_aggregated_daily;
            TRUNCATE sales_bestsellers_aggregated_monthly;
            TRUNCATE sales_bestsellers_aggregated_yearly;

            TRUNCATE sales_creditmemo;
            TRUNCATE sales_creditmemo_comment;
            TRUNCATE sales_creditmemo_grid;
            TRUNCATE sales_creditmemo_item;
            TRUNCATE sales_invoice;
            TRUNCATE sales_invoice_comment;
            TRUNCATE sales_invoice_grid;
            TRUNCATE sales_invoice_item;
            TRUNCATE sales_invoiced_aggregated;
            TRUNCATE sales_invoiced_aggregated_order;
            TRUNCATE sales_order;
            TRUNCATE sales_order_address;
            TRUNCATE sales_order_aggregated_created;
            TRUNCATE sales_order_aggregated_updated;
            TRUNCATE sales_order_grid;
            TRUNCATE sales_order_item;
            TRUNCATE sales_order_payment;
            -- TRUNCATE sales_order_status;
            TRUNCATE sales_order_status_history;
            -- TRUNCATE sales_order_status_label;
            -- TRUNCATE sales_order_status_state;
            TRUNCATE sales_order_tax;
            TRUNCATE sales_order_tax_item;
            TRUNCATE sales_payment_transaction;
            TRUNCATE sales_refunded_aggregated;
            TRUNCATE sales_refunded_aggregated_order;
            -- TRUNCATE sales_sequence_meta;
            -- TRUNCATE sales_sequence_profile;
            TRUNCATE sales_shipment;
            TRUNCATE sales_shipment_comment;
            TRUNCATE sales_shipment_grid;
            TRUNCATE sales_shipment_item;
            TRUNCATE sales_shipment_track;
            TRUNCATE sales_shipping_aggregated;
            TRUNCATE sales_shipping_aggregated_order;

            TRUNCATE tax_order_aggregated_created;
            TRUNCATE tax_order_aggregated_updated;
            TRUNCATE reporting_orders;

            -- EE Only
            TRUNCATE magento_customercustomattributes_sales_flat_order;
            TRUNCATE magento_customercustomattributes_sales_flat_order_address;
            TRUNCATE magento_sales_creditmemo_grid_archive;
            TRUNCATE magento_sales_invoice_grid_archive;
            TRUNCATE magento_sales_order_grid_archive;
            TRUNCATE magento_sales_shipment_grid_archive;


            -- Clearing all cart items
            TRUNCATE quote;
            TRUNCATE quote_address;
            TRUNCATE quote_address_item;
            TRUNCATE quote_id_mask;
            TRUNCATE quote_item;
            TRUNCATE quote_item_option;
            TRUNCATE quote_payment;
            TRUNCATE quote_shipping_rate;

            -- EE Only
            TRUNCATE magento_customercustomattributes_sales_flat_quote;
            TRUNCATE magento_customercustomattributes_sales_flat_quote_address;


            -- Clearing all customers
            TRUNCATE customer_address_entity;
            TRUNCATE customer_address_entity_datetime;
            TRUNCATE customer_address_entity_decimal;
            TRUNCATE customer_address_entity_int;
            TRUNCATE customer_address_entity_text;
            TRUNCATE customer_address_entity_varchar;
            TRUNCATE customer_dummy_cl;
            -- TRUNCATE customer_eav_attribute;
            -- TRUNCATE customer_eav_attribute_website;
            TRUNCATE customer_entity;
            TRUNCATE customer_entity_datetime;
            TRUNCATE customer_entity_decimal;
            TRUNCATE customer_entity_int;
            TRUNCATE customer_entity_text;
            TRUNCATE customer_entity_varchar;
            -- TRUNCATE customer_form_attribute;
            TRUNCATE customer_grid_flat;
            -- TRUNCATE customer_group;
            TRUNCATE customer_log;
            TRUNCATE customer_visitor;
            TRUNCATE persistent_session;

            TRUNCATE wishlist;
            TRUNCATE wishlist_item;
            TRUNCATE wishlist_item_option;

            -- reviews (be careful...)

            TRUNCATE gift_message;
            TRUNCATE review;
            TRUNCATE review_detail;
            -- TRUNCATE review_entity;
            TRUNCATE review_entity_summary;
            -- TRUNCATE review_status;
            TRUNCATE review_store;

            -- Clearing log tables
            TRUNCATE magento_logging_event;
            TRUNCATE magento_logging_event_changes;

            SET FOREIGN_KEY_CHECKS = 1;





            share|improve this answer



























              0














              This is what I have used to clean up test customers & orders:



              -- Magento EE 2.1.1 
              SET FOREIGN_KEY_CHECKS = 0;

              -- Clearing all orders
              TRUNCATE sales_bestsellers_aggregated_daily;
              TRUNCATE sales_bestsellers_aggregated_monthly;
              TRUNCATE sales_bestsellers_aggregated_yearly;

              TRUNCATE sales_creditmemo;
              TRUNCATE sales_creditmemo_comment;
              TRUNCATE sales_creditmemo_grid;
              TRUNCATE sales_creditmemo_item;
              TRUNCATE sales_invoice;
              TRUNCATE sales_invoice_comment;
              TRUNCATE sales_invoice_grid;
              TRUNCATE sales_invoice_item;
              TRUNCATE sales_invoiced_aggregated;
              TRUNCATE sales_invoiced_aggregated_order;
              TRUNCATE sales_order;
              TRUNCATE sales_order_address;
              TRUNCATE sales_order_aggregated_created;
              TRUNCATE sales_order_aggregated_updated;
              TRUNCATE sales_order_grid;
              TRUNCATE sales_order_item;
              TRUNCATE sales_order_payment;
              -- TRUNCATE sales_order_status;
              TRUNCATE sales_order_status_history;
              -- TRUNCATE sales_order_status_label;
              -- TRUNCATE sales_order_status_state;
              TRUNCATE sales_order_tax;
              TRUNCATE sales_order_tax_item;
              TRUNCATE sales_payment_transaction;
              TRUNCATE sales_refunded_aggregated;
              TRUNCATE sales_refunded_aggregated_order;
              -- TRUNCATE sales_sequence_meta;
              -- TRUNCATE sales_sequence_profile;
              TRUNCATE sales_shipment;
              TRUNCATE sales_shipment_comment;
              TRUNCATE sales_shipment_grid;
              TRUNCATE sales_shipment_item;
              TRUNCATE sales_shipment_track;
              TRUNCATE sales_shipping_aggregated;
              TRUNCATE sales_shipping_aggregated_order;

              TRUNCATE tax_order_aggregated_created;
              TRUNCATE tax_order_aggregated_updated;
              TRUNCATE reporting_orders;

              -- EE Only
              TRUNCATE magento_customercustomattributes_sales_flat_order;
              TRUNCATE magento_customercustomattributes_sales_flat_order_address;
              TRUNCATE magento_sales_creditmemo_grid_archive;
              TRUNCATE magento_sales_invoice_grid_archive;
              TRUNCATE magento_sales_order_grid_archive;
              TRUNCATE magento_sales_shipment_grid_archive;


              -- Clearing all cart items
              TRUNCATE quote;
              TRUNCATE quote_address;
              TRUNCATE quote_address_item;
              TRUNCATE quote_id_mask;
              TRUNCATE quote_item;
              TRUNCATE quote_item_option;
              TRUNCATE quote_payment;
              TRUNCATE quote_shipping_rate;

              -- EE Only
              TRUNCATE magento_customercustomattributes_sales_flat_quote;
              TRUNCATE magento_customercustomattributes_sales_flat_quote_address;


              -- Clearing all customers
              TRUNCATE customer_address_entity;
              TRUNCATE customer_address_entity_datetime;
              TRUNCATE customer_address_entity_decimal;
              TRUNCATE customer_address_entity_int;
              TRUNCATE customer_address_entity_text;
              TRUNCATE customer_address_entity_varchar;
              TRUNCATE customer_dummy_cl;
              -- TRUNCATE customer_eav_attribute;
              -- TRUNCATE customer_eav_attribute_website;
              TRUNCATE customer_entity;
              TRUNCATE customer_entity_datetime;
              TRUNCATE customer_entity_decimal;
              TRUNCATE customer_entity_int;
              TRUNCATE customer_entity_text;
              TRUNCATE customer_entity_varchar;
              -- TRUNCATE customer_form_attribute;
              TRUNCATE customer_grid_flat;
              -- TRUNCATE customer_group;
              TRUNCATE customer_log;
              TRUNCATE customer_visitor;
              TRUNCATE persistent_session;

              TRUNCATE wishlist;
              TRUNCATE wishlist_item;
              TRUNCATE wishlist_item_option;

              -- reviews (be careful...)

              TRUNCATE gift_message;
              TRUNCATE review;
              TRUNCATE review_detail;
              -- TRUNCATE review_entity;
              TRUNCATE review_entity_summary;
              -- TRUNCATE review_status;
              TRUNCATE review_store;

              -- Clearing log tables
              TRUNCATE magento_logging_event;
              TRUNCATE magento_logging_event_changes;

              SET FOREIGN_KEY_CHECKS = 1;





              share|improve this answer

























                0












                0








                0







                This is what I have used to clean up test customers & orders:



                -- Magento EE 2.1.1 
                SET FOREIGN_KEY_CHECKS = 0;

                -- Clearing all orders
                TRUNCATE sales_bestsellers_aggregated_daily;
                TRUNCATE sales_bestsellers_aggregated_monthly;
                TRUNCATE sales_bestsellers_aggregated_yearly;

                TRUNCATE sales_creditmemo;
                TRUNCATE sales_creditmemo_comment;
                TRUNCATE sales_creditmemo_grid;
                TRUNCATE sales_creditmemo_item;
                TRUNCATE sales_invoice;
                TRUNCATE sales_invoice_comment;
                TRUNCATE sales_invoice_grid;
                TRUNCATE sales_invoice_item;
                TRUNCATE sales_invoiced_aggregated;
                TRUNCATE sales_invoiced_aggregated_order;
                TRUNCATE sales_order;
                TRUNCATE sales_order_address;
                TRUNCATE sales_order_aggregated_created;
                TRUNCATE sales_order_aggregated_updated;
                TRUNCATE sales_order_grid;
                TRUNCATE sales_order_item;
                TRUNCATE sales_order_payment;
                -- TRUNCATE sales_order_status;
                TRUNCATE sales_order_status_history;
                -- TRUNCATE sales_order_status_label;
                -- TRUNCATE sales_order_status_state;
                TRUNCATE sales_order_tax;
                TRUNCATE sales_order_tax_item;
                TRUNCATE sales_payment_transaction;
                TRUNCATE sales_refunded_aggregated;
                TRUNCATE sales_refunded_aggregated_order;
                -- TRUNCATE sales_sequence_meta;
                -- TRUNCATE sales_sequence_profile;
                TRUNCATE sales_shipment;
                TRUNCATE sales_shipment_comment;
                TRUNCATE sales_shipment_grid;
                TRUNCATE sales_shipment_item;
                TRUNCATE sales_shipment_track;
                TRUNCATE sales_shipping_aggregated;
                TRUNCATE sales_shipping_aggregated_order;

                TRUNCATE tax_order_aggregated_created;
                TRUNCATE tax_order_aggregated_updated;
                TRUNCATE reporting_orders;

                -- EE Only
                TRUNCATE magento_customercustomattributes_sales_flat_order;
                TRUNCATE magento_customercustomattributes_sales_flat_order_address;
                TRUNCATE magento_sales_creditmemo_grid_archive;
                TRUNCATE magento_sales_invoice_grid_archive;
                TRUNCATE magento_sales_order_grid_archive;
                TRUNCATE magento_sales_shipment_grid_archive;


                -- Clearing all cart items
                TRUNCATE quote;
                TRUNCATE quote_address;
                TRUNCATE quote_address_item;
                TRUNCATE quote_id_mask;
                TRUNCATE quote_item;
                TRUNCATE quote_item_option;
                TRUNCATE quote_payment;
                TRUNCATE quote_shipping_rate;

                -- EE Only
                TRUNCATE magento_customercustomattributes_sales_flat_quote;
                TRUNCATE magento_customercustomattributes_sales_flat_quote_address;


                -- Clearing all customers
                TRUNCATE customer_address_entity;
                TRUNCATE customer_address_entity_datetime;
                TRUNCATE customer_address_entity_decimal;
                TRUNCATE customer_address_entity_int;
                TRUNCATE customer_address_entity_text;
                TRUNCATE customer_address_entity_varchar;
                TRUNCATE customer_dummy_cl;
                -- TRUNCATE customer_eav_attribute;
                -- TRUNCATE customer_eav_attribute_website;
                TRUNCATE customer_entity;
                TRUNCATE customer_entity_datetime;
                TRUNCATE customer_entity_decimal;
                TRUNCATE customer_entity_int;
                TRUNCATE customer_entity_text;
                TRUNCATE customer_entity_varchar;
                -- TRUNCATE customer_form_attribute;
                TRUNCATE customer_grid_flat;
                -- TRUNCATE customer_group;
                TRUNCATE customer_log;
                TRUNCATE customer_visitor;
                TRUNCATE persistent_session;

                TRUNCATE wishlist;
                TRUNCATE wishlist_item;
                TRUNCATE wishlist_item_option;

                -- reviews (be careful...)

                TRUNCATE gift_message;
                TRUNCATE review;
                TRUNCATE review_detail;
                -- TRUNCATE review_entity;
                TRUNCATE review_entity_summary;
                -- TRUNCATE review_status;
                TRUNCATE review_store;

                -- Clearing log tables
                TRUNCATE magento_logging_event;
                TRUNCATE magento_logging_event_changes;

                SET FOREIGN_KEY_CHECKS = 1;





                share|improve this answer













                This is what I have used to clean up test customers & orders:



                -- Magento EE 2.1.1 
                SET FOREIGN_KEY_CHECKS = 0;

                -- Clearing all orders
                TRUNCATE sales_bestsellers_aggregated_daily;
                TRUNCATE sales_bestsellers_aggregated_monthly;
                TRUNCATE sales_bestsellers_aggregated_yearly;

                TRUNCATE sales_creditmemo;
                TRUNCATE sales_creditmemo_comment;
                TRUNCATE sales_creditmemo_grid;
                TRUNCATE sales_creditmemo_item;
                TRUNCATE sales_invoice;
                TRUNCATE sales_invoice_comment;
                TRUNCATE sales_invoice_grid;
                TRUNCATE sales_invoice_item;
                TRUNCATE sales_invoiced_aggregated;
                TRUNCATE sales_invoiced_aggregated_order;
                TRUNCATE sales_order;
                TRUNCATE sales_order_address;
                TRUNCATE sales_order_aggregated_created;
                TRUNCATE sales_order_aggregated_updated;
                TRUNCATE sales_order_grid;
                TRUNCATE sales_order_item;
                TRUNCATE sales_order_payment;
                -- TRUNCATE sales_order_status;
                TRUNCATE sales_order_status_history;
                -- TRUNCATE sales_order_status_label;
                -- TRUNCATE sales_order_status_state;
                TRUNCATE sales_order_tax;
                TRUNCATE sales_order_tax_item;
                TRUNCATE sales_payment_transaction;
                TRUNCATE sales_refunded_aggregated;
                TRUNCATE sales_refunded_aggregated_order;
                -- TRUNCATE sales_sequence_meta;
                -- TRUNCATE sales_sequence_profile;
                TRUNCATE sales_shipment;
                TRUNCATE sales_shipment_comment;
                TRUNCATE sales_shipment_grid;
                TRUNCATE sales_shipment_item;
                TRUNCATE sales_shipment_track;
                TRUNCATE sales_shipping_aggregated;
                TRUNCATE sales_shipping_aggregated_order;

                TRUNCATE tax_order_aggregated_created;
                TRUNCATE tax_order_aggregated_updated;
                TRUNCATE reporting_orders;

                -- EE Only
                TRUNCATE magento_customercustomattributes_sales_flat_order;
                TRUNCATE magento_customercustomattributes_sales_flat_order_address;
                TRUNCATE magento_sales_creditmemo_grid_archive;
                TRUNCATE magento_sales_invoice_grid_archive;
                TRUNCATE magento_sales_order_grid_archive;
                TRUNCATE magento_sales_shipment_grid_archive;


                -- Clearing all cart items
                TRUNCATE quote;
                TRUNCATE quote_address;
                TRUNCATE quote_address_item;
                TRUNCATE quote_id_mask;
                TRUNCATE quote_item;
                TRUNCATE quote_item_option;
                TRUNCATE quote_payment;
                TRUNCATE quote_shipping_rate;

                -- EE Only
                TRUNCATE magento_customercustomattributes_sales_flat_quote;
                TRUNCATE magento_customercustomattributes_sales_flat_quote_address;


                -- Clearing all customers
                TRUNCATE customer_address_entity;
                TRUNCATE customer_address_entity_datetime;
                TRUNCATE customer_address_entity_decimal;
                TRUNCATE customer_address_entity_int;
                TRUNCATE customer_address_entity_text;
                TRUNCATE customer_address_entity_varchar;
                TRUNCATE customer_dummy_cl;
                -- TRUNCATE customer_eav_attribute;
                -- TRUNCATE customer_eav_attribute_website;
                TRUNCATE customer_entity;
                TRUNCATE customer_entity_datetime;
                TRUNCATE customer_entity_decimal;
                TRUNCATE customer_entity_int;
                TRUNCATE customer_entity_text;
                TRUNCATE customer_entity_varchar;
                -- TRUNCATE customer_form_attribute;
                TRUNCATE customer_grid_flat;
                -- TRUNCATE customer_group;
                TRUNCATE customer_log;
                TRUNCATE customer_visitor;
                TRUNCATE persistent_session;

                TRUNCATE wishlist;
                TRUNCATE wishlist_item;
                TRUNCATE wishlist_item_option;

                -- reviews (be careful...)

                TRUNCATE gift_message;
                TRUNCATE review;
                TRUNCATE review_detail;
                -- TRUNCATE review_entity;
                TRUNCATE review_entity_summary;
                -- TRUNCATE review_status;
                TRUNCATE review_store;

                -- Clearing log tables
                TRUNCATE magento_logging_event;
                TRUNCATE magento_logging_event_changes;

                SET FOREIGN_KEY_CHECKS = 1;






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Apr 12 '17 at 14:13









                MagePsychoMagePsycho

                3,21211944




                3,21211944



























                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f169880%2fmagento2-remove-sample-data-using-mysql-script%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Magento 2 duplicate PHPSESSID cookie when using session_start() in custom php scriptMagento 2: User cant logged in into to account page, no error showing!Magento duplicate on subdomainGrabbing storeview from cookie (after using language selector)How do I run php custom script on magento2Magento 2: Include PHP script in headerSession lock after using Cm_RedisSessionscript php to update stockMagento set cookie popupMagento 2 session id cookie - where to find it?How to import Configurable product from csv with custom attributes using php scriptMagento 2 run custom PHP script

                    Can not update quote_id field of “quote_item” table magento 2Magento 2.1 - We can't remove the item. (Shopping Cart doesnt allow us to remove items before becomes empty)Add value for custom quote item attribute using REST apiREST API endpoint v1/carts/cartId/items always returns error messageCorrect way to save entries to databaseHow to remove all associated quote objects of a customer completelyMagento 2 - Save value from custom input field to quote_itemGet quote_item data using quote id and product id filter in Magento 2How to set additional data to quote_item table from controller in Magento 2?What is the purpose of additional_data column in quote_item table in magento2Set Custom Price to Quote item magento2 from controller

                    How to solve knockout JS error in Magento 2 Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?(Magento2) knockout.js:3012 Uncaught ReferenceError: Unable to process bindingUnable to process binding Knockout.js magento 2Cannot read property `scopeLabel` of undefined on Product Detail PageCan't get Customer Data on frontend in Magento 2Magento2 Order Summary - unable to process bindingKO templates are not loading in Magento 2.1 applicationgetting knockout js error magento 2Product grid not load -— Unable to process binding Knockout.js magento 2Product form not loaded in magento2Uncaught ReferenceError: Unable to process binding “if: function()return (isShowLegend()) ” magento 2