If you have set up SSH access for a package, you can run the following command-line instructions to import a MySQL database:
mysql -h nombre_de_host -u nombre_de_usuario -p nombre_de_base_de_datos < archivo_de_base_de_datos.sql
The command above connects to your database with the -h (hostname), -u (username) and -p (password) parameters and the database name at the end, and then opens the uncompressed file archivo_de_base_de_datos.sql.
You will then be asked to enter a password for the database. Enter the password and press Enter.
Compressed files
If the database file is compressed, you will first need to decompress it and then you can use one of the following commands:
For a .zip file you can use the unzip command:
- unzip archivo_de_base_de_datos.sql.zip
- mysql -h nombre_de_host -u nombre_de_usuario -p nombre_de_base_de_datos < archivo_de_base_de_datos.sql
For a .gz file you can use the gunzip command:
- gunzip archivo_de_base_de_datos.sql.gz
- mysql -h nombre_de_host -u nombre_de_usuario -p nombre_de_base_de_datos < archivo_de_base_de_datos.sql