Magento 2.3.3 – Can’t Import Database

databaseimportmagento2magento2.3.3

I have created a backup database by command line:

php bin/magento setup:backup –db

Then I import it to my new PHPMyAdmin, But it shows a bug:

Static analysis:

4 errors were found during analysis.

    Unexpected character. (near "\" at position 0)
    Unexpected beginning of statement. (near "\" at position 0)
    Unexpected beginning of statement. (near "nCREATE" at position 1)
    Unrecognized statement type. (near "ALGORITHM" at position 9)

SQL query: Documentation

\nCREATE ALGORITHM=UNDEFINED SQL SECURITY INVOKER VIEW `inventory_stock_1` AS select distinct `legacy_stock_status`.`product_id` AS `product_id`,`legacy_stock_status`.`website_id` AS `website_id`,`legacy_stock_status`.`stock_id` AS `stock_id`,`legacy_stock_status`.`qty` AS `quantity`,`legacy_stock_status`.`stock_status` AS `is_salable`,`product`.`sku` AS `sku` from (`cataloginventory_stock_status` `legacy_stock_status` join `catalog_product_entity` `product` on((`legacy_stock_status`.`product_id` = `product`.`entity_id`))) 

Best Answer

You can try to import the database in your new PHPMyAdmin by following the below few steps.

Step 1: Export the database using the below command with SSH

mysqldump -u USERNAME -p DATABASE_NAME > DATABASE_FILENAME.sql

Step 2: Upload the exported database file on the new server where you want to import it.

Step 3: You can import the database on the new server using the below command with SSH

mysql -u USERNAME -p DATABASE_NAME < DATABASE_FILENAME.sql

Hope this will help you.

Related Topic