mysql在linux中可以不用进入客户端查询得到结果:
[fulei@VM_0_4_centos ~]$ mysql --socket=/home/fulei/mysql/var/mysql.sock -h 122.51.159.155 -utest -ptest qwer -e “select id from test”
±—+
| id |
±—+
| 1 |
| 2 |
| 3 |
| 4 |
±—+
查询结果带了字段名id,去掉字段名可以用-N选项(–skip-column-names(-N)):
[fulei@VM_0_4_centos ~]$ mysql --socket=/home/fulei/mysql/var/mysql.sock -h 122.51.159.155 -utest -ptest qwer -Ne “select id from test”
±–+
| 1 |
| 2 |
| 3 |
| 4 |
±–+