Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

To flush stdout in MySQL, you can use either the "FLUSH" or the "SELECT SLEEP(0)" command.

For example, in a Bash script, you can use the following command to flush stdout before executing the stored procedure:

echo "FLUSH;" | mysql -h $HOST -u $USER -p$PASS $DB

This will send the "FLUSH" command to MySQL to flush the output buffer before executing the stored procedure.

Alternatively, you can use the following command to flush stdout before and after executing the stored procedure:

echo "SELECT SLEEP(0);" | mysql -h $HOST -u $USER -p$PASS $DB

This will execute a command that causes a delay (in this case, zero seconds), but also forces MySQL to flush the output buffer. By running this command before and after executing the stored procedure, you can ensure that all output is flushed to stdout.