group image
Tech Gyan
A shoppezine by JavaGuru
17
 
Posts

 

How to insert/update MySQL DB using linux shell script

 
Home> Blogs> Tech Gyan> How to insert/update MySQL DB using linux shell script
 

Though, I don't recommend using shell scripts to interact with databases here is how you can insert some row in MySQL DB table or update it.

Assuming your database information is as below:

  • Username: myname
  • Password: topsecret
  • Database Name: testdb

The shell script code will look like as below:

output=`mysql -umyname -ptopsecret<<SQLSTATEMENT use testdbinsert into firstable (column1, column2) values ( value1, value2);delete from second where column1=value1; quit SQLSTATEMENT`

 
By: Java  2036 days ago
 
 
 
 
 

Latest Blog Posts

  
 
 
 
 
Be the first one to comment on this post
 
 

Your Reply

 
 
  
 
 
 

Blog Fans

 
 

Photos

No photo uploaded for this blog.
 
 

Featured Blogs