Import a database via SSH
Updated last month
Importing a database from phpMyAdmin is a very simple process, but when our database is very large, it may be necessary to import it from the terminal / SSH.
To do this, from the control panel, we must upload the .sql database through the File Manager (or using an FTP client).
, The next step is to select the Terminal option.
There, we can enter the following command to import the database:
mysql -u USER -p DB < basededatos.sqlAttention: in the command above, we must replace the following:
USER with the previously created MySQL user.
DB with the previously created MySQL database.
basededatos.sql with the name of the .sql file you previously uploaded.
As a security measure, the system will ask us for the MySQL user's password.
Remember to grant the user permissions so they can access and write to the database in question.