user2940867 user2940867 - 9 days ago 8
MySQL Question

Get output from mysql query file source

Can I retrieve output from mysql for the querys inside the file

query.sql
after the import?

mysql --host=localhost --user="root" --password="123456" --database=mytest --execute="SOURCE /var/www/test/WebService/public/tmp/querys.sql"

Answer

Redirect the input of mysql to the file. To get the information messages like 1 row inserted, add the --verbose option.

mysql --verbose --host=localhost --user="root" --password="123456" --database=mytest < /var/www/test/WebService/public/tmp/querys.sql

You can get more messages by using multiple --verbose options.

Comments