从Inno Setup项目中调用MySQL [英] Calling MySQL from inside an Inno Setup project

查看:367
本文介绍了从Inno Setup项目中调用MySQL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为使用MySQL的某些软件编写安装程序.我正在尝试运行.sql脚本以在安装时设置数据库. las,我目前无法执行它.

I'm writing an installer for some software that uses MySQL. I'm trying to run a .sql script to set up the database on install. Alas I'm having big problems getting it to execute at the moment.

问题似乎是由于您在--execute="SOURCE <path to .sql file>"命令中将路径放置到.sql文件的那一刻一切崩溃而引起的.我也试过用管道将其插入,但无法正常工作.但是,如果我从命令行运行它,则会收到围绕它的错误信息,因为该错误信息无法处理其中的"\".

The issue seems to arise from the fact that the moment you put a path to the .sql file inside the --execute="SOURCE <path to .sql file>" command everything falls apart. I've also tried piping it in and it doesn't work. If I run it form the command line, however, I get back errors around it not being able to handle the "\" in there.

有什么办法可以做到这一点?我已经花了一天的时间让我发疯了:(

Is there any way I can do this? Its driving me mad I've spent a day on it already :(

推荐答案

好的,我知道了.如果您从sql文件所在的目录中调用mysql,则基本上可以使用.即--execute ="SOURCE temp.sql".在innosetup下,可以通过如下方式将.sql的路径设置为WorkingDir来完成:

Ok Well I've got it. Basically it works if you are calling mysql from the directory that the sql file is in. ie --execute="SOURCE temp.sql". Under innosetup this can be done by setting the path to the .sql as the WorkingDir as follows:

Filename: "{pf32}\MYSQL\MySQLServer\Bin\MySQL.exe"; BeforeInstall: MakeQuery; AfterInstall: DeleteQuery; WorkingDir: "{app}\Database"; Flags: waituntilterminated; Parameters: "-u root --password=<password>  --database=<db> --execute=""SOURCE temp.sql""";

这篇关于从Inno Setup项目中调用MySQL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆