Before starting, it is important to mention that not all hosting plans provide SSH access. To follow this guide, you will need a plan that includes this feature. The available plans are the Senior plans or higher. You can check our comparison table of plans to find the option that best suits your needs.
Note: The testing platform includes SSH access, but this plan does not allow the activation of external database access, which is required to import a database via SSH.
Prerequisites
- Make sure that SSH access is enabled on your hosting plan. If you need help enabling and accessing SSH, you can follow our support guide.
Uploading the SQL File
Before importing your database, you must upload the .sql file (the database) to your hosting. We recommend using an FTP manager such as FileZilla for this.
Once you access the hosting via FTP, make sure to upload your .sql file to the /entrada folder of your server via FTP.
SSH Connection and Import Commands
Once the file has been uploaded, you can connect to the hosting via SSH. You can obtain the access details from your control panel.
The first step is to establish the connection to the hosting. To do so, you will need the SSH user of your hosting and the server IP. Once entered, the system will ask for the password assigned when SSH access was activated.
Example screenshot of SSH access:
After connecting via SSH, you can run the command ls -la. This command will display a list of the files and folders detected, where you should see the .sql file that you uploaded.
Example screenshot of a listed .sql file:
Next, it is time to start importing the .sql file. Use the following command to import your database:
mysql -u su_usuario_mysql -p -h IP_de_su_alojamiento Nombre_de_su_base_de_datos < archivo_bbdd.sql
You must replace the data marked in bold in the command with the corresponding information. You will need the connection details of the MySQL user and the database where you want to import it: Where to see the MySQL connection details
Example screenshot of executing a .sql file via SSH:
The import may take some time, during which the terminal will not display new lines until the process has finished.
Related Articles
How to import CSV files to MySQL from PHP and SSH
cdmon ensures the security and proper operation of its services. For this reason, certain insecure MySQL functionalities for loading local files in bulk are not available. Below we explain three methods to import data into MySQL. 1.-Import a CSV file ...
Pilotron | Database management in cdmon
Pilotron is your artificial intelligence assistant in the cdmon control panel. With this tool, you can manage and obtain information about your databases quickly and easily, without needing to manually navigate through the control panel. In this ...
How to import and export databases from phpMyAdmin
From phpMyAdmin you can manage your databases, add, delete, or create new content. Two of the most common operations when using phpMyAdmin are importing and exporting databases. First access phpMyAdmin (application used to manage databases) using the ...
How to import MySQL databases from Control Panel
In the cdmon Control Panel you can execute SQL scripts that allow you to import MySQL data into databases directly on the MySQL server. You can find the tool in the hosting Control Panel. To execute a MySQL script, first upload it via FTP to the ...
How to set up the database in Prestashop
PrestaShop is a popular e-commerce platform that allows you to create and manage your online stores effectively. A fundamental part of PrestaShop configuration is the correct database setup. The database stores critical information about products, ...