在Linux命令行上自动刷新MySQL查询

par*_*ars 5 mysql linux command-line

我想在我的linux控制台中看到一个自动刷新的MySQL查询结果.

这样的事情:

while [ 1 ]
do
clear
//some special way of executing 'select id from updates order by id desc limit 1'
sleep 1
done
Run Code Online (Sandbox Code Playgroud)

谢谢

Has*_*kun 11

像下面这样的东西应该工作:

watch -n 1 "mysql -e 'select id from updates order by id desc limit 1' your_db"
Run Code Online (Sandbox Code Playgroud)