现在只能这样干,如果还有其他办法,请指导
把PROCESSLIST的结构存放到表里面,
这里用的是ROOT。
SOCKET是/TMP/MYSQL50.SOCK
[david_test~]# /usr/local/mysql/bin/mysql -uroot -p -S/tmp/mysql50.sock -s -e 'show processlist'> /tmp/processlist.txt
Enter password:
[david_test~]# ./entermysqlroot2
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 454
Server version: 5.0.45-log MySQL Community Server (GPL)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use david_test
Database changed
mysql> create table processlist(id int not null,User varchar(64) not null,host varchar(100) not null,db varchar(64) not null,command char(10) not null,time int, state varchar(255) not null,info text not null);
Query OK, 0 rows affected (0.00 sec)
mysql> load data infile '/tmp/processlist.txt' into table processlist;
Query OK, 14 rows affected (0.00 sec)
Records: 14 Deleted: 0 Skipped: 0 Warnings: 0
mysql> select * from processlist;
+-----+-----------+--------------------+--------------------------+---------+-------+-------+------------------+
| id | User | host | db | command | time | state | info |
+-----+-----------+--------------------+--------------------------+---------+-------+-------+------------------+
| 73 | lisongtao | 192.168.0.50:12341 | colorful_site_lisongtao2 | Sleep | 1 | | NULL |
| 312 | root | 192.168.0.59:2183 | colorful_site_test | Sleep | 5905 | | NULL |
| 313 | root | 192.168.0.59:2184 | NULL | Sleep | 6715 | | NULL |
| 318 | webuser | 192.168.0.23:1490 | colorful_lan | Sleep | 28402 | | NULL |
| 319 | webuser | 192.168.0.23:1491 | NULL | Sleep | 28423 | | NULL |
| 380 | lisongtao | 192.168.0.24:1065 | colorful_site_lisongtao2 | Sleep | 30 | | NULL |
| 381 | lisongtao | 192.168.0.24:1066 | NULL | Sleep | 23182 | | NULL |
| 422 | lisongtao | 192.168.0.24:2417 | colorful_faq | Sleep | 119 | | NULL |
| 439 | lisongtao | 192.168.0.10:2775 | colorful_site_lisongtao2 | Sleep | 2281 | | NULL |
| 440 | webuser | 192.168.0.29:3649 | colorful_lan | Sleep | 6639 | | NULL |
| 444 | lisongtao | 192.168.0.24:5921 | colorful_site_lisongtao2 | Sleep | 581 | | NULL |
| 445 | lisongtao | 192.168.0.10:2889 | colorful_site_lisongtao2 | Sleep | 0 | | NULL |
| 446 | lisongtao | 192.168.0.10:2892 | colorful_site_lisongtao2 | Sleep | 0 | | NULL |
| 453 | root | localhost | NULL | Query | 0 | NULL | show processlist |
+-----+-----------+--------------------+--------------------------+---------+-------+-------+------------------+
14 rows in set (0.00 sec)
mysql> \q
Bye
[david_test~]#
阅读(2748) | 评论(1) | 转发(0) |