Output MySQL source results to log file

前端 未结 3 1224
-上瘾入骨i
-上瘾入骨i 2021-02-01 04:50

I am trying to execute foo.sql using the source command in MySQL.

When I type the command, the file is sourced accordingly:

mysql> source ~/foo.sql


        
相关标签:
3条回答
  • 2021-02-01 05:04

    Use the command line:

    mysql -p dbname < ~/foo.sql > ~/foo.txt
    
    0 讨论(0)
  • 2021-02-01 05:09

    You could do it from the shell prompt:

    $ mysql -p dbname < foo.sql > foo.txt
    
    0 讨论(0)
  • 2021-02-01 05:20

    From within your MySQL client, type

    tee session.out
    

    From that point on, all the I/O of in your current client session is written to the file 'session.out'

    0 讨论(0)
提交回复
热议问题