Reputation: 737
We moved the WooCommerce webstore to a new server, and there are problems with the communication of the database and Wordpress, it seems the DB got corrupted somehow. When I import the DB to the new server's empty DB, it gives the error
The front end seems fine, but many areas don't function (I believe where the writing to db occurs) - eg. comments, file upload and Order - which gives 502 Error.
I checked error_log and it gives some errors like this
[21-Jan-2016 16:28:27 UTC] WordPress adatbázis hiba Duplicate entry '0' for key 'PRIMARY' a lekérdezésben INSERT INTO wp_posts
(post_author
, post_date
, post_date_gmt
, post_content
, post_content_filtered
, post_title
, post_excerpt
, post_status
, post_type
, comment_status
, ping_status
, post_password
, post_name
, to_ping
, pinged
, post_modified
, post_modified_gmt
, post_parent
, menu_order
, post_mime_type
, guid
) VALUES (1, '2016-01-21 17:28:27', '2016-01-21 16:28:27', '', '', 'Order – január 21, 2016 @ 05:28 DU.', 'Próba', 'wc-pending', 'shop_order', 'open', 'closed', 'order_56a1072beeea3', 'rendeles-jan-21-2016-0428-pm', '', '', '2016-01-21 17:28:27', '2016-01-21 16:28:27', 0, 0, '', '') készítette require('wp-blog-header.php'), require_once('wp-includes/template-loader.php'), do_action('template_redirect'), call_user_func_array, WC_AJAX::do_wc_ajax, do_action('wc_ajax_checkout'), call_user_func_array, WC_AJAX::checkout, WC_Checkout->process_checkout, WC_Checkout->create_order, wc_create_order, wp_insert_post
So I believe it could not write to the appropriate field in the DB, and failed.
Any idea, how I can solve this?
Upvotes: 1
Views: 2103
Reputation: 1465
The problem may very well be that certain properties of the table fields (like the AUTO_INCREMENT
) did not get copied over when the schema was copied.
If you are using phpMyAdmin, you can find the table in your database and then click on the Structure tab. For wp_posts
, you'd probably see something like this:
In this case, ID is the identity column, and this table has AUTO_INCREMENT
set. If that is missing from your table, click the Change
button and you will see options to set it.
Unfortunately, if you have one table missing AUTO_INCREMENT
, you probably have others - and if one part of the schema is missing, other important things (unique keys, indexes, etc.) might also be left out - so you should probably reevaluate your database import scripts to see if you can export the full db schema.
Upvotes: 2