Blazej Kita
Blazej Kita

Reputation: 135

Restore db from sql file

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?

Upvotes: 0

Views: 101

Answers (2)

Blazej Kita
Blazej Kita

Reputation: 135

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

Server configuration - No change

Upvotes: 0

RP.S
RP.S

Reputation: 793

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.

Upvotes: 1

Related Questions