1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Import a large database (old hosting formula)
The most common way to import a MySQL database on the servers is to use phpMyAdmin by following this guide. The following import method is a bit more complex; it is generally only for databases that are too large to be imported directly via phpMyAdmin.
Actions to perform
STEP 1
Log in to your administration console
Click on Tools -> Databases
Add a database (or delete/recreate the existing one if it is for restoration)
Under List of existing users, create a MySQL account with all rights on the database
STEP 2
Name the dump files with the name of the target MySQL database (e.g., domainexyz.sql)
Log in via FTP with the admin sys_xxx account
Place the files in the /data directory
STEP 3
Place a file named .my.cnf in the /data directory (note the dot before my)
The file must be of ASCII type (ASCII encoding) and not UTF-8 or otherwise
This file must contain 5 lines:
- the indication
# .my.cnf
(as is - do not modify) - the indication
[client]
(as is - do not modify) - the MySQL server address (admin console -> Tools -> Databases)
- the MySQL username
- the MySQL user password
with line breaks at the end of each line. Example:
# .my.cnf[client]host=mysql.domaine.xyzuser=totopassword=1234
Change the CHMOD of .my.cnf to 0600, meaning read/write for the owner only.
STEP 4
Wait a few minutes for the robot to check for the presence of MySQL dumps in the data directory and import them into the desired database.
After processing, the file "nom de la base MySQL"-"YYYYMMDDHHMMSS".log will contain the result of the queries as well as any import errors. If it is empty, everything is in order, and the dump file nom_de_la_base_mysql_cible.sql will have been renamed to nom_de_la_base_mysql_cible.old.
In pictures
Automated MySQL import
Learn more
The dump must be decompressed. It is important not to rename the compressed file but rather its contents.
The dumps must not contain CREATE DATABASE or CONNECT or USE otherwise the dump will not be imported correctly.
The "source" command is not usable on the servers because the server on which your databases are hosted is not accessible at the file system level.
Infomaniak does not perform a complete deletion of the existing tables in the active database before importing the dump deposited in the /data directory. Your SQL dump should contain the table deletion directives if they need to be deleted beforehand. However, you can also simply delete and recreate the base on your Infomaniak administration interface to empty it.
If the robot runs while the .sql file is still uploading, it may process the incomplete file. To avoid this, you can upload your file with an extension other than .sql so that it is not immediately processed by the robot, and then rename the file once the upload is complete.
If any line of the dump contains an error, it will continue to import the rest. Errors will be found in the file "name of the MySQL database"-"YYYYMMDDHHMMSS".log after processing.
You can also use the script bigdump.php which splits the dump file and performs the import.