show profile cpu, block io for query 15 的结果太大,一屏幕装不下,想将结果输出到一个文件上再看!

解决方案 »

  1.   

    没有什么好办法,mysql.exe 本身没有ORACLE那种spool 的命令。如果是WIDNOWS,则在它的命令行工具的属性中把BUFFER设置高一些。如果是UNIX之类的,倒是可以用一些telnet 的工具本身有记录功能。
      

  2.   

    D:\>mysql -uroot -p -e "show profile cpu, block io for query 15" > e:\aa.txt
    Enter password:D:\>
      

  3.   

    linux下也可以用类似上面的shell命令方法
      

  4.   

    可是在一个session中我必须先执行 set profiling=1和我要测试的sql,之后才能执行show profile cpu, block io for query 15前边的两条语句要如何执行呢?
      

  5.   

    show profile cpu, block io for query 15  
    怎么用学习中...
      

  6.   

    D:\>mysql -uroot -p -e "select * from test ; show profile cpu, block io for query 15" > e:\aa.txt你可以把多个语句放到其中。虽然不方便。
      

  7.   

    可以 into outfile 么我经常用outfile导出表里某个字段的查询结果
      

  8.   

    mysql命令行中可以使用tee output.txt命令记录信息的[coolwind@www ~]$ mysql -uroot -P3307 -h127.0.0.1
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1644
    Server version: 5.1.36 yesType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> helpFor information about MySQL products and services, visit:
       http://www.mysql.com/
    For developer information, including the MySQL Reference Manual, visit:
       http://dev.mysql.com/
    To buy MySQL Network Support, training, or other products, visit:
       https://shop.mysql.com/List of all MySQL commands:
    Note that all text commands must be first on line and end with ';'
    ?         (\?) Synonym for `help'.
    clear     (\c) Clear command.
    connect   (\r) Reconnect to the server. Optional arguments are db and host.
    delimiter (\d) Set statement delimiter. NOTE: Takes the rest of the line as new delimiter.
    edit      (\e) Edit command with $EDITOR.
    ego       (\G) Send command to mysql server, display result vertically.
    exit      (\q) Exit mysql. Same as quit.
    go        (\g) Send command to mysql server.
    help      (\h) Display this help.
    nopager   (\n) Disable pager, print to stdout.
    notee     (\t) Don't write into outfile.
    pager     (\P) Set PAGER [to_pager]. Print the query results via PAGER.
    print     (\p) Print current command.
    prompt    (\R) Change your mysql prompt.
    quit      (\q) Quit mysql.
    rehash    (\#) Rebuild completion hash.
    source    (\.) Execute an SQL script file. Takes a file name as an argument.
    status    (\s) Get status information from the server.
    system    (\!) Execute a system shell command.
    tee       (\T) Set outfile [to_outfile]. Append everything into given outfile.
    use       (\u) Use another database. Takes database name as argument.
    charset   (\C) Switch to another charset. Might be needed for processing binlog with multi-byte charsets.
    warnings  (\W) Show warnings after every statement.
    nowarning (\w) Don't show warnings after every statement.For server side help, type 'help contents'mysql> tee t.txt
    Logging to file 't.txt'
    mysql> select 1+2;
    +-----+
    | 1+2 |
    +-----+
    |   3 |
    +-----+
    1 row in set (0.01 sec)mysql> exit
    Bye
    [coolwind@www ~]$ cat t.txt
    mysql> select 1+2;
    +-----+
    | 1+2 |
    +-----+
    |   3 |
    +-----+
    1 row in set (0.01 sec)mysql> exit
      

  9.   

    INTO OUTFILE也可以的~e.g. select * INTO OUTFILE'C:/AAA.txt' from emp;
      

  10.   

    上面的挺正确的,但只能是输出为txt格式文件的
      

  11.   

    奇怪,
    mysql命令行的话,不是有一个tee吗?