mysql 控制台格式化输出_mysql控制台输出格式化问题

我的mysql检测命令是写在一个mysqlxj.sql文件中,然后让一个.sh文件调用,产生一个.log文件,但是现在能执行sql文件,也有.log文件产生,但是log里的结果混在一起没法分开;奇怪的是,system echo syscommand,会优先于所有查询结果执行,导致结果很难看懂。具体如下:

mysqlxj.sql文本部分内容:

system echo "**********database version*********"

show variables like 'version%';

system echo ""

system echo "**********databases*********"

show databases;

system echo ""

system echo "**********database tables*********"

show tables;

system echo ""

system echo "**********option excution over 2 s*********"

show global status like '%slow%';

system echo ""

system echo "**********database max used connections*********"

show global status like '%max_used_connections%';

system echo ""

system echo "**********database bytes count*********"

show status like 'Bytes%';

system echo ""

system echo "**********database processlist*********"

show processlist;

system echo ""

system echo "**********database threads*********"

show status like 'Threads%';

system echo ""

system echo "**********database table status*********"

show status like 'table%';

system echo ""

system echo "**********database key read*********"

show status like 'key_read%';

system echo ""

system echo "**********database key read requests*********"

show global status like '%Key_read_requests%';

system echo ""

产生的.log文件如下:

**********database version*********

**********databases*********

**********database tables*********

**********option excution over 2 s*********

**********database max used connections*********

**********database bytes count*********

**********database processlist*********

**********database threads*********

**********database table status*********

**********database key read*********

**********database key read requests*********

**********database key blocks*********

**********database qcache*********

**********database temple table*********

**********database temple table created*********

**********database table cached*********

**********database query sort in memery count*********

**********database files open mark*********

**********database locks table count*********

**********database innodb flush method*********

**********database innodb row lock waits*********

**********database table locks waited*********

**********database log warnings*********

**********database expire logs days*********

Variable_name Value

version 5.6.16

version_comment Source distribution

version_compile_machine i686

version_compile_os Linux

Database

information_schema

cdcol

mysql

performance_schema

phpmyadmin

test

Tables_in_mysql

columns_priv

db

event

func

general_log

help_category

help_keyword

help_relation

help_topic

host

innodb_index_stats

innodb_table_stats

ndb_binlog_index

plugin

proc

procs_priv

proxies_priv

servers

slave_master_info

slave_relay_log_info

slave_worker_info

slow_log

tables_priv

time_zone

time_zone_leap_second

time_zone_name

time_zone_transition

time_zone_transition_type

user

Variable_name Value

Slow_launch_threads 0

Slow_queries 0

Variable_name Value

Max_used_connections 2

Variable_name Value

Bytes_received 443

Bytes_sent 1793

到底该怎么写才能让show查出来的内容被类似两条system命令给包围起来,因为这样容易阅读。先谢谢前辈们了!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值