How to rebuild Magento corrupt database ready for migration to Magento 2.3.0

We have an existing old live Magento website (which is completely backed up).

We have built a new Magento 2.3.0 website which is ready to go live, but just needs the old Magento data migrated into it.

Our first problem is the Magento MySQL database is/was corrupt.

We have created a new default Magento website using a copy of the original database and successfully run the Magento Database Repair Tool 1.2 as per the instructions.

The Database Repair Tool only found and fixed 2 errors:

Add missing foreign keys:



to table “catalog_category_flat”

enter image description here

After the initial repairs, running the tool again found no errors.

However, the databse is huge (about 280MB) and there are clearly more problems.

How can we clean up the database?

Our second problem is Magento admin ‘Customers/Manage Customers’ only displays 13 customers, but this should be about 1000 customers.

All of the other missing customers and their data is still in the Magento store and visible when viewed via ‘Sales/Invoices’ and ‘Sales/Orders’.

Magento admin displays 1054 ‘Sales/Invoices’

Magento admin displays 1081 ‘Sales/Orders’

Magento admin displays 1002 ‘Sales/Shipments’

Magento admin displays 48 ‘Sales/Credit Memos’

Magento admin displays 945 ‘Catalog/Manage Products’

How can we recreate all of the hidden customers?

Our third problem is how to export and migrate all the Magento data into the new Magento 2.3.0?

We need all of the data including the following:

Orders, Order addresses, Order payments, Payment transactions, Order status history, Quotes, Invoices, Invoice comments or Invoice items, Shipments, Shipment comments, Shipped items, Shipments tracking, Credit Memos, Credit Memo comments, Credit Memo items, Checkout fields, Products, Customers

How can we successfully migrate all of the data?