--演示部分,演示常用命令
--connect命令
mysql> connect chardb localhost;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Connection id: 5
Current database: chardb
--设置分页,在多余一个页面显示时会不停的翻滚,用该命令可以设置分页,设置为调用系统命令
mysql> pager more --设置为more方式
PAGER set to 'more'
mysql> select table_name,table_type,engine from information_schema.tables; --该查询会超出一屏显示后按空格键会自动翻滚到下一屏
mysql> pager tail -5; --设置输出尾部5行
PAGER set to 'tail -5'
mysql> select table_name,table_type,engine from information_schema.tables;
| setup_timers | BASE TABLE | PERFORMANCE_SCHEMA |
| threads | BASE TABLE | PERFORMANCE_SCHEMA |
| animals | BASE TABLE | InnoDB |
| shop | BASE TABLE | InnoDB |
+----------------------------------------------+-------------+--------------------+
92 rows in set (0.02 sec)
mysql> pager; --查看当前的pager设置
PAGER set to 'tail -5'
mysql> nopager; --切换到标准(缺省)pager方式
PAGER set to stdout
--tee命令,输出日志文件
mysql> tee /tmp/query.log --开启输出到文件,相当与SQL*plus下的spool
Logging to file '/tmp/query.log'
mysql> select table_name,table_type,engine from information_schema.tables;
+----------------------------------------------+-------------+--------------------+
| table_name | table_type | engine |
+----------------------------------------------+-------------+--------------------+
| CHARACTER_SETS | SYSTEM VIEW | MEMORY |
| COLLATIONS | SYSTEM VIEW | MEMORY |
.............
mysql> notee; --关闭输出到文件,相当于SQL*Plus下的spool off
Outfile disabled.
mysql> system tail /tmp/query.log --查看输出的日志文件
| setup_consumers | BASE TABLE | PERFORMANCE_SCHEMA |
| setup_instruments | BASE TABLE | PERFORMANCE_SCHEMA |
| setup_timers | BASE TABLE | PERFORMANCE_SCHEMA |
| threads | BASE TABLE | PERFORMANCE_SCHEMA |
| animals | BASE TABLE | InnoDB |
| shop | BASE TABLE | InnoDB |
+----------------------------------------------+-------------+--------------------+
92 rows in set (0.02 sec)
--改变mysql提示符
mysql> prompt SessionA>
PROMPT set to 'SessionA> '
--恢复到缺省提示符
SessionA> prompt;
Returning to default PROMPT of mysql>