1

Let's say I am importing a small SQL file using the MySQL client like so:

mysql < 10k-file.sql

The mysql client does not output anything. How can I force it to show how many rows are affected for each query, errors, so on?

2 Answers 2

0

You can use the general log

so enable general log

but be careful this will log everything what happens and gets fast big

0

Use this

mysql < 10k-file.sql > import.log 2>&1

This will import the dump and send any messages to import.log The 2>&1 sends error messages to the log.

if there was an error, it will stop the import.

In that case, use this

mysql --force < 10k-file.sql > import.log 2>&1
1
  • You need the verbose option to make it print the statements and number of rows affected: mysql -v -v --force < 10k-file.sql > import.log 2>&1 Note that the -v is given twice to make it more verbose.
    – dbdemon
    Commented Jan 5, 2022 at 13:02

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.