• Hello,

    after backing up all databases:

    mysqldump -uroot -ppass --all-databases | gzip > "all_databases.gz"

    Restoring databases where WooCommerce is present causes the following error. All other databases are restored successfully.

    gunzip -c all_databases.gz | sed -n '/^-- Current Database: 'mydb'/,/^-- Current Database: '/p' | gzip -9 > mydb.sql.gz
    gunzip < mydb.sql.gz | mysql -uuser -ppass --default-character-set=utf8mb4
    
    ERROR 1005 (HY000) at line 1085: Can't create table 'mydb'.'wp_wc_download_log' (errno: 150 "Foreign key constraint is incorrectly formed")
    
    SHOW ENGINE INNODB STATUS
    
    LATEST FOREIGN KEY ERROR
    ------------------------
    2021-04-19 10:47:07 0x150a00974700 Error in foreign key constraint of table 'mydb'.'wp_wc_download_log':
    Create  table 'mydb'.'wp_wc_download_log' with foreign key constraint failed. Referenced table 'mydb'.'wp_woocommerce_downloadable_product_permissions' not found in the data dictionary near ' FOREIGN KEY ('permission_id') REFERENCES 'wp_woocommerce_downloadable_product_permissions' ('permission_id') ON DELETE CASCADE
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci'.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Support lionel.a11n

    (@lioneldaniel)

    Hello @mrtuxit,

    It has been awhile, but if you are still experiencing this issue I would like to check which version of WooCommerce you are using.

    Could you please share a copy of your site’s System Status? You can find it via WooCommerce > Status. Select “Get system report” and then “Copy for support”.? Once you’ve done that, paste it here in your response.

    There has been this issue in past versions of WooCommerce, and if you are able to replicate this on a database from a site with a default theme theme and no plugins installed except the latest WooCommerce it would be important for us to investigate.

    Here is that past issue for your reference in case it helps: https://github.com/woocommerce/woocommerce/issues/24769

    We look forward to hearing back from you in case this hasn’t yet been resolved. Thank you!

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Since it’s been a while since we last heard back from you, I’m going to mark this thread resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers! ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can’t create table wp_wc_download_log errno: 150 Foreign key constraint’ is closed to new replies.