Hi,
I want to run some queries in mysql. Also, I want to automate this process. So can someone help me with shell scripting??
I want to open mysql in terminal, type in the password and give some queries..
Can I write a script for d whole thing??

Are these "some queries" the same every time or are you doing them interactively? If the same every time, then a script (or shell function) would be reasonable. Otherwise, I recommend the mysql command line tool.

ya... I wil use the same commands everytime.... can we use echo inside mysql command line??? or is it only for terminal???
i want to automate thw writing part in d command line....

if you invoke mysql --help, you will see a lot of possibilities. I believe you want the -e "command string" option, along with -u -p and database name. I just tried this, successfully

mysql -utest -pTEST test -e 'select * from dummy_table'

(all this on my Mac)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.