开发者

MySQL Command-Line Script

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜