0

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?

6
  • what is the content of your sql file ??? Commented Oct 12, 2022 at 10:15
  • run Mysql console, connect to server, and run source commande : source file.sql; Commented Oct 12, 2022 at 10:17
  • Before.. I dump final DB to copy test version, mysqldump -u root -p dbx12_final > my_db_t_2022_10_12.sql Commented Oct 12, 2022 at 10:18
  • what is the version MySQL do you use ??? Commented Oct 12, 2022 at 10:27
  • Well, when I put mysql -v I got the same error: mysql -v sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION'. Commented Oct 12, 2022 at 11:52

2 Answers 2

1

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Server configuration - No change

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.