Logging to file 'mysql_result.log'
mysql> tee mysql_result.log
Logging to file 'mysql_result.log'
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| postfix |
| test |
| ucenter |
| wordpress |
| zabbix |
+--------------------+
7 rows in set (0.00 sec)
mysql> show processlist;
+----+------+-----------+---------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+---------+---------+------+-------+------------------+
| 4 | root | localhost | ucenter | Sleep | 5564 | | NULL |
| 5 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+----+------+-----------+---------+---------+------+-------+------------------+
2 rows in set (0.01 sec)
mysql> \q
Bye
[root@ www.linuxidc.com ~]# cat mysql_result.log
mysql> tee mysql_result.log
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| postfix |
| test |
| ucenter |
| wordpress |
| zabbix |
+--------------------+
7 rows in set (0.00 sec)
mysql> show processlist;
+----+------+-----------+---------+---------+------+-------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+----+------+-----------+---------+---------+------+-------+------------------+
| 4 | root | localhost | ucenter | Sleep | 5564 | | NULL |
| 5 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+----+------+-----------+---------+---------+------+-------+------------------+
2 rows in set (0.01 sec)
mysql> \q
[root@ www.linuxidc.com ~]# mysql --tee=mysql_result.log
Logging to file 'mysql_result.log'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.1.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show engines;
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| Engine | Support | Comment | Transactions | XA | Savepoints |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
| CSV | YES | CSV storage engine | NO | NO | NO |
| MRG_MYISAM | YES | Collection of identical MyISAM tables | NO | NO | NO |
| FEDERATED | NO | Federated MySQL storage engine | NULL | NULL | NULL |
| MyISAM | DEFAULT | Default engine as of MySQL 3.23 with great performance | NO | NO | NO |
| InnoDB | YES | Supports transactions, row-level locking, and foreign keys | YES | YES | YES |
| MEMORY | YES | Hash based, stored in memory, useful for temporary tables | NO | NO | NO |
+------------+---------+------------------------------------------------------------+--------------+------+------------+
6 rows in set (0.00 sec)
mysql> \q
Bye
[root@ www.linuxidc.com ~]# mysqladmin shutdown
[root@ www.linuxidc.com ~]# vim /usr/local/mysql/etc/my.cnf
[client]
tee = /tmp/mysql_result.log
[root@ www.linuxidc.com ~]# /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf --datadir=/data/mysql/data --user=mysql &
[1] 2620
[root@ www.linuxidc.com ~]# 120731 20:28:30 mysqld_safe Logging to '/data/mysql/data/tech.err'.
120731 20:28:30 mysqld_safe Starting mysqld daemon with databases from /data/mysql/data
[root@ www.linuxidc.com ~]# mysql
Logging to file '/tmp/mysql_result.log'
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.1.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
