echo " MYSQL_STATEMENT" | mysql -u user_name -p>>
/path/to/file
this should work fine on command line .
cheers
David Ziggy Lubowa
Network Engineer
One2net (U)
web: www.one2net.co.ug
Tel: +256 41 345466
---
Every minute is an occasion to change your l
Mike,
> How do i redirect a mysql output to a file from the command line?
> For example, I want to save DESCRIBE test_table > test_table.file
> without doing a MYSQLDUMP.
To have the mysql client write a protocol, start it, and then do:
mysql> tee myoutfile.txt
Logging to file 'myoutfile.txt'
On Mon, Feb 24, 2003 at 10:50:53AM -0700, Mike Doanh Tran wrote:
> Hi,
>
> How do i redirect a mysql output to a file from the command line?
> For example, I want to save DESCRIBE test_table > test_table.file
> without doing a MYSQLDUMP.
Use the mysql command line client from your command lin
In *NIX you could do this:
$ echo "sql commands here" | mysql -uroot -ppassword -hhost database >
/path/to/file
For extra scripting fun you could backup tables using this:
for i in `echo "show databases" | /usr/local/mysql/bin/mysql -uroot |
grep -v "Database"`
do
mysqldump -uroot $i > /path/t
At 10:50 AM 2/24/2003 -0700, Mike Doanh Tran wrote:
>How do i redirect a mysql output to a file from the command line?
>For example, I want to save DESCRIBE test_table > test_table.file
>without doing a MYSQLDUMP.
>From the command line:
$ echo 'describe test_table' | mysql {dbname} > test_ta