-
SQL > importation, exportation avec dump
EXPORTER UNE BASE
mysqldump -u username -p nom_base > marecup.sql
IMPORTER UNE BASE
NOTE : avant d’importer une base, il faut la créer dans mysql ou mariadb, et si le fichier sql contient
CREATE DATABASE, il faut le commenter.mysql -u username -p nom_base < fichier.sql
ERREURS
ERROR 1044:
Access denied for user ‘username1‘@’localhost‘ to database ‘username2_database‘when the import file contains an SQL statement that attempts to access a database for the wrong username. Note in this example that username2 in username2_database does not match username1 in ‘username1‘@’localhost‘. You must edit the import file and change username2 to your new username1.
ERROR 1049:
Unknown database ‘username_database‘when the target database does not exist. Make sure you create the database first as described above, and then try to it import again.
ERROR 1064:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘username_database‘ at line x.when the import file does not contain backup data for a database or there is a MySQL syntax error in the file.
ERROR 1227:
Access denied; you need (at least one of) the SUPER privilege(s) for this operationif the import file contains one or more SQL statements that require superuser privileges (such as SET GLOBAL or CREATE DEFINER statements). In some cases, you can just delete these statements from the .sql file and rerun the import process. For example, CREATE DATABASE statements can be safely removed, because you should have already created the database in cPanel. If you require MySQL superuser access, however, you should consider migrating your account to a VPS or Dedicated server, where you have complete control over the environment.