I just wanted to know what would be the easiest way to retrieve simple data
from a MySQL database from a bash script.
Easiest way I've used to do it is:
mysql EOQ
select count(1) from tables;
EOQ
Which allows you to feed random queries to mysql from a bash script.
Brad
On Sun, 30 Jan 2005, Andy wrote:
Hi all
I just wanted to know what would be the easiest way to retrieve simple data
from a MySQL database from a bash script.
I do this a lot - just construct the query and dump it into a file from
within the script, eg:
echo select * from widgets
Thank you all for your replies.
I think that ShellSQL is really the thing I am looking for.
With kind regards
Andy
On Sun January 30 2005 23:50, Andy wrote:
Hi all
I just wanted to know what would be the easiest way to retrieve simple data
from a MySQL database from a bash script.
On Mon, Jan 31, 2005 at 06:57:58PM +, Edward Macnaghten wrote:
1 - The output is not cluttered with headers, and a means exist to
easily separate fields when there is more than one column or row in the
query.
The mysql --batch option should take care of that for you.
-Jason Martin
--
If
Forgive me for blowing my own trumpet here.
The advantage with ShellSQL over this method is
1 - The output is not cluttered with headers, and a means exist to
easily separate fields when there is more than one column or row in the
query.
2 - The connection is persistant, whereas running
Funny you should mention that
May I guide you to my recent announcment of ShellSQL 0.7 - web page at
http://www.edlsystems.com/shellsql - a utility to do just as you want (I
think) released under GPL.
It must be good - I wrote it myself :-)
Yours
Eddy
Andy wrote:
Hi all
I just wanted to
Edward Macnaghten wrote:
Funny you should mention that
May I guide you to my recent announcment of ShellSQL 0.7 - web page at
http://www.edlsystems.com/shellsql - a utility to do just as you want
(I think) released under GPL.
It must be good - I wrote it myself :-)
SELECT * FROM /dev/zero