开发者

MySQL Command-Line Script

开发者 https://www.devze.com 2023-02-14 00:09 出处:网络
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

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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消