Execute mysql command from shell

phpMyAdmin is a very slow application if you want to execute a query on your database. If you know the name of the database then any GUI tool is an overhead. So I have written a one liner shell script to do that for me 🙂

Here\’s the script:

echo \”select * from table where field like \”%$1%\”\”|mysql -h doamin.com -u amit -p -D amit -r –password=hello

When run with one argument it will execute the sql query directly without asking for password also.

This site uses Akismet to reduce spam. Learn how your comment data is processed.