How to Execute Query & Stored Procedure in Linux Using Shell Scripting.



How to Execute Query & Stored Procedure in Linux Using Shell Scripting.

You can simply use below mention script for executing the query or procedure.
#!/bin/sh
mysql -u root –ppassword -e 'call test_procedure();' Databasename

Where -p is used password in which you can mention the password of your mysql.
Where -e is used for executing the  query or stored procedure.
Where databasename is used for your mysql database name.

#!/bin/sh
mysql -u root –ppassword -e ‘select * from tbl_test;’ Databasename

 This single line can be used for  executing stored procedure as well as sql query.

You can save this script into any extension of file but you need to give the permission first
for executing the script file
for example:
#chmod +x filename

Comments

Popular posts from this blog

How to Read Excel File in VC++....

Window could not start the Apache tomcat 6 on Local Computer.For more information, review the System Events Logs.If this is a non-Microsoft service,contact service vendor, and refer to service-specific error code 0.

How to Bind Multiple SMPP Acounts Using Kannel SMS Gateway.