Execute mysql command from shell
2010-02-04
84 words
1 min read
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.
Related Articles:
- 2010/01/07 shell — one liner to selectively change case
- 2009/11/21 feh – versatile image viewer works from command line too.
- 2009/10/04 Get list of git repositories from command line.
- 2009/10/01 phpMyEdit – Mysql table viewer, editor and php code generator.
- 2009/09/26 Script to generate a html file with link to all files in directory
Authored By Amit Agarwal
Amit Agarwal, Linux and Photography are my hobbies.Creative Commons Attribution 4.0 International License.