» Quick Links
You can make money on these forums
We Share profits with you
Google
Google Adsense
Google Adwords
YPN
Yahoo
MSN Search
Web Directories
Web Hosting
Web Hosting Offers
Hosting News
Suggestions
Link Building
Domain Names
PHP Forums
MySQL Forums
» More Links
OSP News
Reseller Hosting
Shared Hosting
Dedicated Servers
Google Adsense
Search Engine Marketing
Link Development
Affiliate Marketing


» Advertising
Multiple DC PR Check

Free SEO Tools


Go Back   Webmaster Forums > Website Developement / Programming > MySQL Forums

MySQL Forums Share Your Ideas and Tips about MYSQL. Ask questions about MYSQL. Table Design and Much More...

Reply
 
Thread Tools Display Modes
  #1  
Old 11-08-2006, 05:06 AM
Diwel Diwel is offline
Junior Member
 
Join Date: Nov 2006
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
Diwel is on a distinguished road
Default how to run sql scripts from a shell script?

Hi friends,
I need to run some sql scripts from a shell script where two values are passed in as parameters. Does anyone know if it can be achieved in MySQL?
Thanks. -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Revenue Sharing Ads ( ?):
  #2  
Old 11-08-2006, 05:08 AM
ishac ishac is offline
Senior Member
 
Join Date: Jul 2006
Posts: 120
Thanks: 0
Thanked 1 Time in 1 Post
Rep Power: 18
ishac is on a distinguished road
Default

I think mysql CLI does not have support for setting user variables as command-line options. Try to set the value in the SQL script, or create a new SQL script dynamically in your shell script:
echo "SET @foo := 42;" > /tmp/set-var.sql
echo "SOURCE /tmp/set-var.sql; SOURCE my_sql_script.sql;" > /tmp/turnkey.sql
mysql ..options.. < /tmp/turnkey.sql
rm /tmp/set-var.sql /tmp/turnkey.sql -- This message may have been cut off and the rest will only be shown to members. To become a member, click here --
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Scripts aaron Web Design Templates 4 10-25-2008 02:46 PM
Can FTP sessions be carried to another script? kipper PHP Programming and Tips 1 08-12-2006 11:52 AM
DiscountASP.NET Launches SQL Database Transfer Tool outsourcingplans Web Hosting News 0 08-09-2006 04:23 AM
DiscountASP.NET Introduces New Services outsourcingplans Web Hosting News 0 08-08-2006 07:42 AM
DiscountASP.NET Launches SQL 2005 & ASP.NET 2.0 Hosting outsourcingplans Web Hosting News 0 11-29-2005 02:50 PM


All times are GMT. The time now is 05:03 AM.