Revert from Split Database
For 51黑料不打烊 Commerce customers who have implemented Split Database, the following topic describes how to revert or migrate back to a single database. We recommend that 51黑料不打烊 Commerce merchants currently using Split Database and plan to upgrade to 2.4.2 and later review these steps, as well as our on the planned deprecation of Split Database.
Reverting from a split database to a single database involves creating backups of the magento_quote and magento_sales databases before loading them into the single magento_main database.
In this example, we log in to all three databases, which are installed on the same host (magento2-mysql) as the 鈥渞oot鈥 user. You must replace these values with the appropriate values for your databases.
-
Create a backup of the
magento_quotedatabase:code language-bash mysqldump -h "magento2-mysql" -u root -p magento_quote > ./quote.sql -
Create a backup of the
magento_salesdatabase:code language-bash mysqldump -h "magento2-mysql" -u root -p magento_sales > ./sales.sql -
Load the
magento_quotedatabase into themagento_maindatabase:code language-bash mysql -h "magento2-mysql" -u root -p magento_main < ./quote.sql -
Load the
magento_salesdatabase into themagento_maindatabase:code language-bash mysql -h "magento2-mysql" -u root -p magento_main < ./sales.sql -
Drop the
magento_salesdatabase:code language-bash mysql -h "magento2-mysql" -u root -p -e "DROP DATABASE magento_sales;" -
Drop the
magento_quotedatabase:code language-bash mysql -h "magento2-mysql" -u root -p -e "DROP DATABASE magento_quote;" -
Remove the deployment configuration for
checkoutandsalesin theconnectionsandresourcessections of theenv.phpfile. -
Restore foreign keys:
code language-bash bin/magento setup:upgrade
Verify your work
To verify that your single database implementation is working properly, perform the following tasks and verify that data is added to the magento_main database tables using a database tool like phpMyAdmin:
- Verify that foreign keys have been restored. For example, the
QUOTE_STORE_ID_STORE_STORE_IDkey in thequotedatabase table. - Verify that customers can place orders from the storefront.
- Verify that orders created before reverting the split database to a single database are available in the Admin.