How Connect to a Database in Shell Programming?

Answer Posted / supraja

mysql -uusername -ppassword -hipaddress database -e "statement"

eg:mysql -uroot -psuppu -h192.168.0.1 supraja -e "select
count(*) from table"

Is This Answer Correct ?    2 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why is shell scripting important?

578


I want to monitor a continuously updating log file, what command can be used to most efficiently achieve this?

756


What is difference between shell and bash scripting?

551


In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?

641


How will you emulate wc –l using awk?

913






What is bash used for?

581


What does it mean to debug a script?

575


How do I run a script from command prompt?

562


What does chmod do?

578


Can shell script run on windows?

570


How to pass an argument to a script?

596


How do I stop script errors?

578


Why is it called a shell?

509


What is the meaning of $1 in shell script?

600


Where is bash history?

508