$ mysql -uroot --htmlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3286Server version: 5.1.24-rc-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> select * from test.test;<TABLE BORDER=1><TR><TH>i</TH></TR><TR><TD>1</TD></TR><TR><TD>2</TD></TR></TABLE>2 rows in set (0.00 sec)
2.以xml格式输出结果
跟上面差不多,使用–xml或者-X选项,可以将结果输出为xml格式
$ mysql -uroot --xmlWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 3287Server version: 5.1.24-rc-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> select * from test.test;<?xml version="1.0"?><resultset statement="select * from test.test;"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <row> <field name="i">1</field> </row> <row> <field name="i">2</field> </row></resultset>2 rows in set (0.00 sec)
3.修改命令提示符
使用mysql的–prompt=选项,或者进入mysql命令行环境后使用 prompt命令,都可以修改提示符
mysql> prompt \u@\d>PROMPT set to '\u@\d>'root@(none)>use mysqlReading table information for completion of table and column namesYou can turn off this feature to get a quicker startup with -ADatabase changedroot@mysql>
其中\u表示当前连接的用户,\d表示当前连接的数据库,其他更多的可选项可以参考man mysql