there are several things that possible could go wrong. that is why there are several solutions:
1.Ran the following SQL to find the rows that were causing the problem, then deleted the rows and ran the indexer again
WHERE `category_id` NOT
2. Export your original database using PhpMyAdmin. From the Options section in PhpMyAdmin, find and select:
Disable foreign key checks
3. Using any Linux editor such as vi or pico, edit the database file: YOUR-DATABASE-NAME.sql. Copy and paste the following line at the beginning of the file:
4. Go to in Model and find this code in any php file and make some changes.
the line: $newproduct->setWebsiteIDs(array(0)); should be: $newproduct->setWebsiteIDs(array(1));
As an alternative for manipulation with php and your database you may try Cart2Cart migration service. It will require to install a fresh version of Magento and then migrate your products, clients and orders from your current Magento version. However, you won\’t be able to move design.