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 ???
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 ???