Home / Prestashop / How to Import the Database via Terminal (mysql)

How to Import the Database via Terminal (mysql)

How to Import the Database via Terminal (mysql). Recommended method for PrestaShop 8.x with clear steps, verification, and troubleshooting.

Views: 23 Unique: 20 Updated: 2026-03-19

What this procedure is

This article explains how to import a database via terminal using the mysql command. It is recommended for large files.

Applies to: PrestaShop 8.x.

Why you would do this

  • Restore large backups.
  • Migrate without phpMyAdmin limits.

Prerequisites

  • SSH access.
  • Target database created.
  • User with privileges.

Quick diagnosis (before you change anything)

1) Confirm the target DB is empty (ideal)

Expected result: avoid duplicate data.


Import via terminal (mysql)

Step 1) Upload the file to the server

Upload the .sql or .sql.gz to the target server.

Step 2) Import the SQL

Example:

mysql -u USER -p DB_NAME < prestashop.sql

Step 3) If the file is compressed

Example:

gunzip -c prestashop.sql.gz | mysql -u USER -p DB_NAME

Step 4) Update PrestaShop credentials

Update app/config/parameters.php if DB/user changed.

Final verification

  • The store connects without a DB error.
  • Tables exist with the correct prefix.

If something doesn’t work (common issues)

Import stops mid-way

  • Check disk space.
  • Review server limits.
  • Ensure MySQL/MariaDB compatibility.

Best practices

  • Enable maintenance during import.
  • Clear cache afterwards and verify checkout.
Back to category