开发者

Do you have additional examples of executing MySql with Wix?

I'm still working on my Wix installer that includes replacing some MySql commands.

Specifically, I want the insta开发者_高级运维ller to run a script that creates a user, and then using that user, I want the installer to run a script that creates a database and creates tables. (It seems that an installer should be able to do this.)

I posted earlier about the user, and haven't been able to figure that out yet.

So skipping that for a moment, let's assume that my user exists. This user happens to not have a password. Without the installer, the command I usually do to run my script that creates the database and tables is:

mysql --user=myname < thisismyscript.sql

This works fine - so I know my script works.

Two problems I see in the Wix, and I'm hoping someone can either explain, or post additional examples (I learn best by seeing others examples).

1) seems to be the lack of a password.

In the .wxs file, I have:

<util:User Id='SQLUser' Name='[SQLUSER]' />

<Component Id='SqlComponent' Guid='7B524167-D8CF-465E-AEE8-6B70CF712A3A' KeyPath='yes'>
<sql:SqlDatabase Id='SqlDatabase' Database='adatabase' User='SQLUser' Server='[SQLSERVER]'
                    CreateOnInstall='yes' DropOnUninstall='yes' ContinueOnError='yes'>
<sql:SqlScript Id='mynewdb' BinaryKey='mynewdb' ExecuteOnInstall='yes' />
</sql:SqlDatabase>
</Component>

<Binary Id='mynewdb' SourceFile='thisismyscript.sql' />

<Property Id='SQLUSER'>myname</Property>
<Property Id='SQLSERVER'>localhost</Property>

(this is all embeded in the right places in the .wxs file and the file compiles fine... it's just when I run the .msi, my database has not been created.)

The only way I was able to leave the password property blank was to add that Admin tag. I'm not sure what to do here.

  1. The second problem is that within the SQLComponent, I had to write down a database name, but of course, this database doesn't actually exist yet. Is this a problem? (I also tried creating the database manually, so that when the .msi ran it would already be there... but then nothing else happened)

I also ran msiexec with logging, and it appears that my sql script executes... there are no errors that I can see in the log.

Help? This really seems like something an installer should be able to do... and that I'm just doing something wrong...

Thanks in advance!

-Adeena


Neither WiX nor MSI has native support for MySQL. InstallShield has MySQL support.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜