About Me

My photo
Working as Technical Lead in CollabNET software private limited.
Showing posts with label queries. Show all posts
Showing posts with label queries. Show all posts

Thursday, 25 June 2009

Capture the results of the queries executed in mysqlclient in a file (no copy and paste)

One way is to copy the mysqlclient screen and paste it into a text file. The other way is to use tee.

mysql>
mysql> tee mysql-1.txt
Logging to file 'mysql-1.txt'
mysql> show databases;
+----------------+
| Database |
+----------------+
| test_db |
| db_3 |
| db_4 |
| db_5 |
+----------------+
4 rows in set (0.00 sec)

mysql> exit
Bye

[thiru@cu065 tmp]$ less mysql-1.txt

mysql> show databases;
+----------------+
| Database |
+----------------+
| test_db |
| db_3 |
| db_4 |
| db_5 |
+----------------+
4 rows in set (0.00 sec)

mysql> exit