Solved

Execute MySQL .sql files in an Inno Setup Installer

Posted on 2009-07-08
2
6,813 Views
Last Modified: 2013-11-09
I have been working on an installer that does several things. The part I'm having trouble with is getting some .sql files to set up the database, user, permission, and initial table structure for the application.

For reference, I am using MySQL 5.1 and Inno Setup 5 on Windows XP.

Using the [Run] section to run the command line mysql didn't work because it wouldn't allow the file to be piped in.

Any suggestions would be greatly appreciated.
[Run]

; this doesn't work

Filename: "c:\program files\mysql\mysql server 5.1\bin\mysql.exe"; Parameters: " -u user < file.sql "

Open in new window

0
Comment
Question by:mainemoose
2 Comments
 
LVL 18

Expert Comment

by:mirtheil
ID: 24805568
What do you mean by "doesn't work"?  
Looking at the Run command, the "user" may be causing you a problem.  
What do you get if you run the exact same thing from a command prompt?  I used the following and it seemed to work:

[Run]

; this doesn't work

Filename: "c:\program files\mysql\mysql server 5.1\bin\mysql.exe"; Parameters: " -u root < file.sql "

Open in new window

0
 
LVL 2

Accepted Solution

by:
mainemoose earned 0 total points
ID: 24805893
Oh, I found it :)
[RUN]

Filename: "{pf}\MySQL\MySQL Server 4.1\bin\mysql.exe"; \

Parameters: "-e ""source create_db.sql"""; \

Flags: waituntilterminated runhidden;

Open in new window

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Join & Write a Comment

One of the most frequently asked questions on EE in the "Windows Installer" zone is how to eliminate self-triggered installation of some product.  The problem occurs when, suddenly, whenever a certain application is launched, or even when a folder i…
I have been using r1soft Continuous Data Protection (http://www.r1soft.com/linux-cdp/) for many years now with the mySQL Addon and wanted to share a trick I have used several times. For those of us that don't have the luxury of using all transact…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now