Home > Back-end >  Restore db from sql file
Restore db from sql file

Time:10-13

I am tring import data from sql file using command line like this:

mysys-12: mysql -u root -p my_db_t < my_db_t_2022_10_12.sql

but I got:

mysql: [ERROR] unknown variable 'sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTIO

How can I import data? Should I add any params?

CodePudding user response:

It seems that the content in the sql file conflicts with the constraint of sql_mode. There are two methods. The first method is to modify the content of the file to meet the constraint of sql_mode. The second method is to set SQL _ mode ='' in mysql. Then import the data and change it back.

CodePudding user response:

Problem solved, I removed sql-mode from client configuration, file: etc/mysql/conf.d/mysql.cnf

Server configuration - No change

  • Related