how to create a log file at the same time to run a batch file in mysql database -


i trying run batch file , running okay want store output of same batch file @ same time separate file on location.

file created there no content in file.

i trying following command

c:\program files (x86)\mysql\mysql server 5.5\bin>mysql -h localhost -u root -p12345 db1552 < c:\users\naveen\desktop\script.txt > c:\users\naveen\desktop\mysqllog.txt 

tuesday001.sql (generates resultset):

use stackoverflow; select qid,title questions_mysql order qid desc limit 10; 

tuesday001.sql (generates no resultset):

use stackoverflow; use so_gibberish; use stackoverflow; 

test:

c:\program files\mysql\mysql server 5.6\bin>mysql -h localhost -u root -p < c:\nate\tuesday001.sql > c:\nate\tuesday001_out.txt enter password: ********  c:\program files\mysql\mysql server 5.6\bin>type c:\nate\tuesday001_out.txt qid     title 38712320        [partition benifit on indexed column] 38712318        netbeans not show mysql procedures 38712287        how search pattern matching values in mysql 38712285        adjust json response in array , objects 38712109        getting syntax errors while trying compile functiom 38711996        update table using computation 2 other tables 38711904        can concatenate strings within prepare() function insert specified tables 38711887        unable disabled checkbox after checkbox status changed in database 38711875        rails inserting incorrect `order` statement 38711794        save blob image width &amp;amp; height vb.net mysql  c:\program files\mysql\mysql server 5.6\bin>mysql -h localhost -u root -p < c:\nate\tuesday002.sql > c:\nate\tuesday002_out.txt enter password: ********  c:\program files\mysql\mysql server 5.6\bin>type c:\nate\tuesday002_out.txt  c:\program files\mysql\mysql server 5.6\bin>dir c:\nate\tuesday*.txt  volume in drive c os  volume serial number 1c7c-0b63   directory of c:\nate  08/02/2016  02:13               672 tuesday001_out.txt 08/02/2016  02:15                 0 tuesday002_out.txt                2 file(s)            672 bytes 

so, means input file contained no commands generated resultset, above shows both test files, , output.

edit

the following works in interactive mode:

mysql --tee="c:\nate\trythis00j.txt" -h localhost -u root -p 

which logs interactive commands file in append mode. not work thru command-line redirection unfortunately.

c:\program files\mysql\mysql server 5.6\bin>type \nate\trythis00j.txt welcome mysql monitor.  commands end ; or \g. mysql connection id 22 server version: 5.6.31-log mysql community server (gpl)  copyright (c) 2000, 2016, oracle and/or affiliates. rights reserved.  oracle registered trademark of oracle corporation and/or affiliates. other names may trademarks of respective owners.  type 'help;' or '\h' help. type '\c' clear current input statement.  mysql> use stackoverflow; database changed mysql> create table j2(id int); query ok, 0 rows affected (0.36 sec)  mysql> quit 

Comments