Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command-line params

Status
Not open for further replies.

barryp

Programmer
Jan 30, 2002
48
GB
Hi

On a Linux server I use MySQL

I have a shellscript run by CRON which initialises one of my databases

I need to DROP & re-CREATE the database & then initialise the tables
I have an SQL file to do this but how can I pass the database name to the SQL script ?

init.sql contains

DROP '$database'
CREATE '$database'
CREATE TABLE xxx etc..

The following line is fine for creating the tables but I need to pass the database name into the SQL script for the DROP & CREATE

mysql -h host -u user -ppwd $database < init.sql

Can I pass an extra parameter to mysql ???
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top