0

I'm trying to run a script with MySQL on Windows like this :

mysql.exe -h 127.0.0.1  databaseName -uroot < path\to\my\script.sql

On my script I do some stuff like this

select 'start'; 

select 'import';
SOURCE import some other sql with functions and procedures

select 'run';
some stuff

select 'end';

And when I'm looking for logs I found this :

start
start
import
import
run
run
end
end

Did you know why MySQL is doing this ?

6
  • what logs do you check? what command do you use to output to log? provide script.sql Commented Apr 5, 2017 at 13:12
  • when I say logs, I'm means all select statement on the script I can see on the standard output Commented Apr 5, 2017 at 13:14
  • 1
    so if your script contain just 1 line select 'start'; are you still getting it twice? seem like sqlfiddle.com/#!9/9eecb7d/98044 mysql is outputting column title and values. so to check this theory you can try select 'start' as my_command; You'll see the difference ;-) Commented Apr 5, 2017 at 13:17
  • yep that is my problem Commented Apr 5, 2017 at 13:18
  • 1
    sqlfiddle.com/#!9/9eecb7d/98046 Commented Apr 5, 2017 at 13:26

1 Answer 1

1

Seem like

http://sqlfiddle.com/#!9/9eecb7d/98044

mysql is outputting column title and values.

To check this theory you can try http://sqlfiddle.com/#!9/9eecb7d/98046

select 'start' as my_command; 

or

select 'start' as step; 

You'll see the difference ;-)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.