1

These are the commands I need to execute in a script. The date 2011.02.14 needs to be a parameter:

mysql --user=myusername --password=mypassword  
connect mydatabase  
source /var/www/2011.02.14.sql  
exit

How would I execute a script to do this?

Is the "mysql --user=myusername..." part of the script, or part of the command-line for executing the rest of the script?

Thanks much.

1 Answer 1

1

Enclose your commands in a here doc

mysql --user=myusername --password=mypassword  << here_doc
connect mydatabase  
source /var/www/2011.02.14.sql  
exit
here_doc
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.