Ubuntu – Run MySQL Command In Background – nohup

background-processMySQLnohup

I need to run in background mode some mysql-query…
But how can i do this with nohup?

Standardly i do:

mysql -uroot -p
use SomeDb;
Select * from blablalba;

But how can i do this with launching in db process?
i do mysql importing with nohup, but how with query?

Best Answer

mysql -u [username] -p [database_name] -e "[sql_query]"

Example:

nohup mysql -u root -p somedb -e "select * from mytable" &