* Cindy Yu
> I am new to mysql. I know, in Oracle, when you spool file, then
> spool off, this will create a file on your server. What is the
> equivalent command for Mysql.
>
> For example:
> sqlplus> Spool  C:\temp\table_names
> sqlplus> select table_name from user_tables;
> sqlplus> spool off;
>
> This will create a file on the server.

mysql have something similar, tee and notee:

mysql> use mysql
Database changed
mysql> tee c:\trash\qwe.txt
Logging to file 'c:\trash\qwe.txt'
mysql> show tables;
+-----------------+
| Tables_in_mysql |
+-----------------+
| columns_priv    |
| db              |
| host            |
| tables_priv     |
| user            |
+-----------------+
5 rows in set (0.02 sec)

mysql> notee
Outfile disabled.
mysql>

If the file exist, the output will be appended to the existing file.

As you can see, the output is also displayed on the screen. This may not be
what you want, especially if the output is big... You could use

  mysql -e "select table_name from user_tables" database > output.txt

or

  mysql database < script.sql > output.txt

from the os command line. (You may also need to use -u, -p and/or -h, use
the same as when you do a 'normal' start of the mysql client.)

--
Roger


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to