How to “select * from table from database” with -e? I want to select and show 1 row form a table with the mysql -e.

I was trying out the following but no luck,

mysql -u root -e “select * from table1 from db01 limit 1”


Actually I am trying to dump a single line from hundreads of tables to take a sample from them and redirect to a file. So I want to use shell and don’t want to be in MySQL console.

I have used show the above way but select is not working. 

Everyone is suggesting to do select * from table1 but didn’t mentioned how to mention database. 
So how can I achieve this?
Got it!

Just had to add the database name before the execute flag (-e) and the sql statement.,

mysql -u root db01 -e “select * from table1 limit 1”


Where,


db01 is the database name 
table1 is the table name
limit 1 for showing only 1 record