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?
You can use the general log
so enable general log
but be careful this will log everything what happens and gets fast big
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
mysql -v -v --force < 10k-file.sql > import.log 2>&1
Note that the -v
is given twice to make it more verbose.