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 into MySQL from PHP
Below is an example PHP script that performs this type of import:
while (($data = fgetcsv($handle, 1000, ",")) !== FALSE) { $import = "INSERT INTO $table (text, number) VALUES ('$data[0]', '$data[1]')"; mysql_query($import) or die(mysql_error()); }fclose($handle);}
You should take the following aspects into account when importing data from PHP:
If any of the limits established in your hosting plan are exceeded, the process will not complete correctly.
2.-Import an SQL file into MySQL from SSH
With SSH access enabled (
How to enable SSH access) on your hosting, you can perform a console import with the following command:
$ cat "archivo_importar.sql" | mysql -u Usuario -p NombreBaseDeDatos
- User: MySQL user.
- DatabaseName: name of the destination database where the queries defined in “archivo_importar.sql” will be executed.
3.-Import an SQL file into MySQL from the Control Panel
Related Articles
How to import a database by SSH
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 ...
Wordpress structure and files
WordPress is the most well-known and widely used CMS in the world. It allows you to develop websites without having extensive knowledge of programming or web development. Hence its great success. After all, WordPress is an interface that allows you ...
Basic SSH Manual
Buy Web Domain and SSL Certificates With SSH access, you can work with your files and directories securely, connecting from an application or command-line interpreter. Below we provide an example of a command-line interpreter for each of the most ...
How to connect to MySQL via SSH
Any hosting that has SSH access enabled can connect to MySQL via console. To do so, you must use the following command: mysql -h ipweb -u databaseuser -p -h: In this option, enter the web IP of the hosting. You can check the IP in the Server ...
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 ...