Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

auto-refreshing MySQL query on Linux commandline

I would like to see a auto refreshing MySQL query result in my linux console.

something like this:

while [ 1 ]
do
clear
//some special way of executing 'select id from updates order by id desc limit 1'
sleep 1
done

Thanks

like image 466
pars Avatar asked Aug 02 '11 14:08

pars


People also ask

How do I refresh a table in MySQL?

To access the Refresh from Database dialog box, right-click an object in MySQL Metadata Explorer and click Refresh from Database.

What are MySQL commands?

SQL commands are instructions, coded into SQL statements, which are used to communicate with the database to perform specific tasks, functions and queries with data.

How do I create a sequence in MySQL workbench?

The simplest way for creating a sequence in MySQL is by defining the column as AUTO_INCREMENT during table creation, which should be a primary key column.


1 Answers

Something like the following should work:

watch -n 1 "mysql -e 'select id from updates order by id desc limit 1' your_db"
like image 159
Hasturkun Avatar answered Oct 02 '22 01:10

Hasturkun