PostgreSQL
In PostgreSQL it is possible to execute commands without entering the postgres=#
console by executing sudo -u postgres psql -c "\l"
instead of entering the console first and executing \l
. By doing this psql commands can be directly executed in one step instead of two steps.
MySQL
In MySQL, sudo -u root mysql -c ""
is not accepted as in PSQL. So the console has to be entered first by executing sudo mysql -u root
before further commands can be issued.
Question
Is it possible to execute MySQL commands directly (one step) instead of entering the console first and issuing commands (two steps) like in PostgreSQL?