Magento 2 : Foreign key constraint is incorrectly formed, ALTER TABLE customer_groupupgrade issue from 2.1.14 to 2.2 :: magento2Reindexing foreign key constraint fails on Attribute's IndexMagento import tables from old database show error (errno: 150 “Foreign key constraint is incorrectly formed”)How to export and import categories from MySQLMagento 2.2 : Cannot Add SubcategoryForeign key constraint fails Entity_Type_IDIntegrity constraint error referring to quote_item table while adding product to cartMagento 2 : Unique constraint violation found when adding product, categories or mega menu itemsI faced the error while search any string Magento 2Foreign key constraint is incorrectly formed after upgrade to 2.3.0ALTER TABLE `customer_group` MODIFY COLUMN `customer_group_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT

How can I convert a linear narrative into a branching narrative?

If the Moon were impacted by a suitably sized meteor, how long would it take to impact the Earth?

Microgravity indicators

How to prevent a single-element caster from being useless against immune foes?

Is it unprofessional to mention your cover letter and resume are best viewed in Chrome?

Can you continue the movement of a Bonus Action Dash granted by Expeditious Retreat if your Concentration is broken mid-move?

How to efficiently shred a lot of cabbage?

Word for giving preference to the oldest child

PCB design using code instead of clicking a mouse?

Using Python in a Bash Script

What are the closest international airports in different countries?

"DDoouubbllee ssppeeaakk!!"

Correct word for a little toy that always stands up?

Should students have access to past exams or an exam bank?

Move arrows along a contour

Reading electrical clamp tester higher voltage/amp 400A

How does Asimov's second law deal with contradictory orders from different people?

My employer is refusing to give me the pay that was advertised after an internal job move

What is a good example for artistic ND filter applications?

Is there any way to work simultaneously on the same DAW project remotely?

Why would an invisible personal shield be necessary?

Why did Windows 95 crash the whole system but newer Windows only crashed programs?

Unknown indication below upper stave

Why tantalum for the Hayabusa bullets?



Magento 2 : Foreign key constraint is incorrectly formed, ALTER TABLE customer_group


upgrade issue from 2.1.14 to 2.2 :: magento2Reindexing foreign key constraint fails on Attribute's IndexMagento import tables from old database show error (errno: 150 “Foreign key constraint is incorrectly formed”)How to export and import categories from MySQLMagento 2.2 : Cannot Add SubcategoryForeign key constraint fails Entity_Type_IDIntegrity constraint error referring to quote_item table while adding product to cartMagento 2 : Unique constraint violation found when adding product, categories or mega menu itemsI faced the error while search any string Magento 2Foreign key constraint is incorrectly formed after upgrade to 2.3.0ALTER TABLE `customer_group` MODIFY COLUMN `customer_group_id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















After upgrade from magento 2.1.7 to 2.2.3 and am stuck. I have tried everything.




In Pdo.php line 235:

SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to './zwwnzwzjhe/customer_group' (errno:
150 - Foreign key constraint is incorrectly formed), query was: ALTER
TABLE customer_group MODIFY COLUMN customer_group_id int(10)
UNSIGNED NOT NULL AUTO_INCREMENT



In Pdo.php line 228: SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to
'./zwwnzwzjhe/customer_group' (errno: 150 - Foreign key constraint is
incorrectly formed)




I am unable to delete this table or make any changes to this table ...please help.



Thank you










share|improve this question
































    4















    After upgrade from magento 2.1.7 to 2.2.3 and am stuck. I have tried everything.




    In Pdo.php line 235:

    SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to './zwwnzwzjhe/customer_group' (errno:
    150 - Foreign key constraint is incorrectly formed), query was: ALTER
    TABLE customer_group MODIFY COLUMN customer_group_id int(10)
    UNSIGNED NOT NULL AUTO_INCREMENT



    In Pdo.php line 228: SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to
    './zwwnzwzjhe/customer_group' (errno: 150 - Foreign key constraint is
    incorrectly formed)




    I am unable to delete this table or make any changes to this table ...please help.



    Thank you










    share|improve this question




























      4












      4








      4








      After upgrade from magento 2.1.7 to 2.2.3 and am stuck. I have tried everything.




      In Pdo.php line 235:

      SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to './zwwnzwzjhe/customer_group' (errno:
      150 - Foreign key constraint is incorrectly formed), query was: ALTER
      TABLE customer_group MODIFY COLUMN customer_group_id int(10)
      UNSIGNED NOT NULL AUTO_INCREMENT



      In Pdo.php line 228: SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to
      './zwwnzwzjhe/customer_group' (errno: 150 - Foreign key constraint is
      incorrectly formed)




      I am unable to delete this table or make any changes to this table ...please help.



      Thank you










      share|improve this question
















      After upgrade from magento 2.1.7 to 2.2.3 and am stuck. I have tried everything.




      In Pdo.php line 235:

      SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to './zwwnzwzjhe/customer_group' (errno:
      150 - Foreign key constraint is incorrectly formed), query was: ALTER
      TABLE customer_group MODIFY COLUMN customer_group_id int(10)
      UNSIGNED NOT NULL AUTO_INCREMENT



      In Pdo.php line 228: SQLSTATE[HY000]: General error: 1025 Error on rename of './zwwnzwzjhe/#sql-1bd1_25f9' to
      './zwwnzwzjhe/customer_group' (errno: 150 - Foreign key constraint is
      incorrectly formed)




      I am unable to delete this table or make any changes to this table ...please help.



      Thank you







      magento2 database customer foreign-key






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Mar 3 at 16:08









      Vishwas Bhatnagar

      3,0632 gold badges23 silver badges46 bronze badges




      3,0632 gold badges23 silver badges46 bronze badges










      asked Mar 3 at 14:47









      rogerroger

      1762 silver badges16 bronze badges




      1762 silver badges16 bronze badges























          1 Answer
          1






          active

          oldest

          votes


















          0














          To work around this, use either of these solutions. Both present risks of damaging the data integrity.



          Option 1:



          Remove constraints
          Perform TRUNCATE
          Delete manually the rows that now have references to nowhere
          Create constraints


          Option 2:



          SET FOREIGN_KEY_CHECKS = 0; 
          TRUNCATE table customer_group;
          SET FOREIGN_KEY_CHECKS = 1;





          share|improve this answer

























          • nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

            – roger
            Mar 3 at 16:15












          • @roger even when you are using second option ?

            – Vishwas Bhatnagar
            Mar 3 at 16:16











          • Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

            – roger
            Mar 3 at 16:20











          • Query seems to be executed , i don't see any errors @roger

            – Vishwas Bhatnagar
            Mar 3 at 16:30











          • 0 rows affected. i still get the same error so I am guessing now effect is taking place

            – roger
            Mar 3 at 16:35













          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%2f264178%2fmagento-2-foreign-key-constraint-is-incorrectly-formed-alter-table-customer-g%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














          To work around this, use either of these solutions. Both present risks of damaging the data integrity.



          Option 1:



          Remove constraints
          Perform TRUNCATE
          Delete manually the rows that now have references to nowhere
          Create constraints


          Option 2:



          SET FOREIGN_KEY_CHECKS = 0; 
          TRUNCATE table customer_group;
          SET FOREIGN_KEY_CHECKS = 1;





          share|improve this answer

























          • nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

            – roger
            Mar 3 at 16:15












          • @roger even when you are using second option ?

            – Vishwas Bhatnagar
            Mar 3 at 16:16











          • Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

            – roger
            Mar 3 at 16:20











          • Query seems to be executed , i don't see any errors @roger

            – Vishwas Bhatnagar
            Mar 3 at 16:30











          • 0 rows affected. i still get the same error so I am guessing now effect is taking place

            – roger
            Mar 3 at 16:35















          0














          To work around this, use either of these solutions. Both present risks of damaging the data integrity.



          Option 1:



          Remove constraints
          Perform TRUNCATE
          Delete manually the rows that now have references to nowhere
          Create constraints


          Option 2:



          SET FOREIGN_KEY_CHECKS = 0; 
          TRUNCATE table customer_group;
          SET FOREIGN_KEY_CHECKS = 1;





          share|improve this answer

























          • nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

            – roger
            Mar 3 at 16:15












          • @roger even when you are using second option ?

            – Vishwas Bhatnagar
            Mar 3 at 16:16











          • Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

            – roger
            Mar 3 at 16:20











          • Query seems to be executed , i don't see any errors @roger

            – Vishwas Bhatnagar
            Mar 3 at 16:30











          • 0 rows affected. i still get the same error so I am guessing now effect is taking place

            – roger
            Mar 3 at 16:35













          0












          0








          0







          To work around this, use either of these solutions. Both present risks of damaging the data integrity.



          Option 1:



          Remove constraints
          Perform TRUNCATE
          Delete manually the rows that now have references to nowhere
          Create constraints


          Option 2:



          SET FOREIGN_KEY_CHECKS = 0; 
          TRUNCATE table customer_group;
          SET FOREIGN_KEY_CHECKS = 1;





          share|improve this answer













          To work around this, use either of these solutions. Both present risks of damaging the data integrity.



          Option 1:



          Remove constraints
          Perform TRUNCATE
          Delete manually the rows that now have references to nowhere
          Create constraints


          Option 2:



          SET FOREIGN_KEY_CHECKS = 0; 
          TRUNCATE table customer_group;
          SET FOREIGN_KEY_CHECKS = 1;






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Mar 3 at 16:07









          Vishwas BhatnagarVishwas Bhatnagar

          3,0632 gold badges23 silver badges46 bronze badges




          3,0632 gold badges23 silver badges46 bronze badges















          • nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

            – roger
            Mar 3 at 16:15












          • @roger even when you are using second option ?

            – Vishwas Bhatnagar
            Mar 3 at 16:16











          • Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

            – roger
            Mar 3 at 16:20











          • Query seems to be executed , i don't see any errors @roger

            – Vishwas Bhatnagar
            Mar 3 at 16:30











          • 0 rows affected. i still get the same error so I am guessing now effect is taking place

            – roger
            Mar 3 at 16:35

















          • nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

            – roger
            Mar 3 at 16:15












          • @roger even when you are using second option ?

            – Vishwas Bhatnagar
            Mar 3 at 16:16











          • Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

            – roger
            Mar 3 at 16:20











          • Query seems to be executed , i don't see any errors @roger

            – Vishwas Bhatnagar
            Mar 3 at 16:30











          • 0 rows affected. i still get the same error so I am guessing now effect is taking place

            – roger
            Mar 3 at 16:35
















          nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

          – roger
          Mar 3 at 16:15






          nothing works I am unable to delete manually due to foreign key, Option 2 also doesnt work when i truncate, I get the Cannot truncate a table referenced in a foreign key constraint (zwwnzwzjhe.catalog_product_bundle_price_index, CONSTRAINT catalog_product_bundle_price_index_ibfk_1 FOREIGN KEY (customer_group_id) REFERENCES zwwnzwzjhe.customer_group (`customer_) 16:14:18 SQL command

          – roger
          Mar 3 at 16:15














          @roger even when you are using second option ?

          – Vishwas Bhatnagar
          Mar 3 at 16:16





          @roger even when you are using second option ?

          – Vishwas Bhatnagar
          Mar 3 at 16:16













          Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

          – roger
          Mar 3 at 16:20





          Yes SET FOREIGN_KEY_CHECKS = 0 Query executed OK, 0 rows affected. (0.000 s) Edit TRUNCATE table customer_group Query executed OK, 0 rows affected. (0.023 s) Edit SET FOREIGN_KEY_CHECKS = 1 Query executed OK, 0 rows affected. (0.000 s) Edit

          – roger
          Mar 3 at 16:20













          Query seems to be executed , i don't see any errors @roger

          – Vishwas Bhatnagar
          Mar 3 at 16:30





          Query seems to be executed , i don't see any errors @roger

          – Vishwas Bhatnagar
          Mar 3 at 16:30













          0 rows affected. i still get the same error so I am guessing now effect is taking place

          – roger
          Mar 3 at 16:35





          0 rows affected. i still get the same error so I am guessing now effect is taking place

          – roger
          Mar 3 at 16:35

















          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%2f264178%2fmagento-2-foreign-key-constraint-is-incorrectly-formed-alter-table-customer-g%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

          Get product attribute by attribute group code in magento 2get product attribute by product attribute group in magento 2Magento 2 Log Bundle Product Data in List Page?How to get all product attribute of a attribute group of Default attribute set?Magento 2.1 Create a filter in the product grid by new attributeMagento 2 : Get Product Attribute values By GroupMagento 2 How to get all existing values for one attributeMagento 2 get custom attribute of a single product inside a pluginMagento 2.3 How to get all the Multi Source Inventory (MSI) locations collection in custom module?Magento2: how to develop rest API to get new productsGet product attribute by attribute group code ( [attribute_group_code] ) in magento 2

          Category:9 (number) SubcategoriesMedia in category "9 (number)"Navigation menuUpload mediaGND ID: 4485639-8Library of Congress authority ID: sh85091979ReasonatorScholiaStatistics

          Magento 2.3: How do i solve this, Not registered handle, on custom form?How can i rewrite TierPrice Block in Magento2magento 2 captcha not rendering if I override layout xmlmain.CRITICAL: Plugin class doesn't existMagento 2 : Problem while adding custom button order view page?Magento 2.2.5: Overriding Admin Controller sales/orderMagento 2.2.5: Add, Update and Delete existing products Custom OptionsMagento 2.3 : File Upload issue in UI Component FormMagento2 Not registered handleHow to configured Form Builder Js in my custom magento 2.3.0 module?Magento 2.3. How to create image upload field in an admin form