Skip to content

Instantly share code, notes, and snippets.

@biswarupadhikari
Created August 1, 2012 20:11
Show Gist options
  • Save biswarupadhikari/3230289 to your computer and use it in GitHub Desktop.
Save biswarupadhikari/3230289 to your computer and use it in GitHub Desktop.
How to Run Mysql Query In Shell Script
dbHost="localhost"
dbUsername="root"
dbPass="rootwdp"
dbName="test"
dbTbl="users"
userCol="username"
passCol="password"
$username="user1"
$password="pass123"
mysql -u $dbUsername -p"$dbPass" $dbName -e "INSERT INTO $dbTbl($userCol,$passCol) VALUES('$username','$password')";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment