Link to home
Start Free TrialLog in
Avatar of Zberteoc
ZberteocFlag for Canada

asked on

MySQL: run sql script file in command line and get the erros in a log file

When you run a sql script file in command line with MySQL you can redirect the output of the query in a file but not the errors apparently:

>mysql -uuser -ppassword < sql_script_file > output_file

If the sql_script_file returns a result like table rows they will get into the output_file but if there is an error within the script it is not redirected to the outpyt_file but only to the console.

How can I get the errors from a script file to be saved to a output_file with MySQL.
Avatar of reb73
reb73
Flag of Ireland image

Have you tried using the --tee switch to output everything to an output file..

See complete command line reference below -

http://www.techotopia.com/index.php/The_mysql_Command-Line_Tool
ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Zberteoc

ASKER

Thanks, that was it!