Steps to import a MySQL database from the command line
To import a database, you must first have that database created on the destination server and have a copy of the database to import.
Once the database has been created on the destination server and you have uploaded the database file to import, you just need to follow these steps:
- Access your server via SSH
Additional Information
You can find more information about accessing your server via SSH in the article:
- Run the following command:
mysql -u usuario -p nombre_basededatos < data.sql
Where “usuario” is the database user, “nombre_basededatos” is the database name, and “data.sql” is the name of the database copy.
This command will import / restore the database using the provided .SQL file.
Additional Information
If you need more information about backing up or exporting a database, you can consult our articles: