Step 1: Login to MySQL
Step 2: In the MySQL command prompt, type the below command.
mysql> tee log.out
Logging to file 'log.out'
mysql>
You should see a message “Logging to file” displayed on the screen.
Step 3: Now, source the SQL file
mysql> source sample.sql
Step 4: The output of source command would have been logged into a file log.out.
Step 5: View the log.out
$ more log.out
————————————————