How Connect to a Database in Shell Programming?

Answer Posted / sibin kc

You can simply use as follows.

mysql -h <hostname> -u <user name> -p<password> -e "use
psa;select * from domains where domain_name = 'hai.com';"

Is This Answer Correct ?    9 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

how will you find the total disk space used by a specific user?

584


What is path in shell script?

641


Write a command sequence to find the count of each word?

542


How do I set bash as default shell mac?

559


What is awk in shell script?

756






How do you debug a script?

569


How to calculate the number of passed arguments?

558


Hello all, This is my assignment on shell scripting, can anyone help me regarding this ? Create a shell script which connects to the database In second shell script include the first script for the DB connection Create a table (PRADEEP_DATA) with 2 columns (name, value) In Third shell script include the first script for the DB connection And insert/delete the values from the Table, by accepting input from the user This functionality should be a menu driven Program: 1) Insert to the database a. Name b. value 2)Delete from the database a.Name b.value Exception handling needs to be taken care.

1857


What is echo in shell?

640


What are the zombie processes?

568


What does .sh file contain?

556


What is console line?

574


What is a program shell?

572


How to debug the problems encountered in the shell script/program?

632


What's the difference between scripting and coding?

599