How to import mysql database through command line in advanced installer

296 views Asked by At

I try to use Advanced Installer 13.1 to make an installer for my C# project working with MySQL database.

I can connect MySQL database and also i can log in using Custom Actions tab in advanced installer but i cannot continue to import my file(test.sql).

mysql> -h localhost -u root -p1234 dbtest < D:\test.sql

So i tried to run this on command prompt.It easily and successfully worked but cannot work in my advanced installer project.I don't know why.

Could you please to answer my question?

Here is a screen shot of my advanced installer project:

enter image description here

2

There are 2 answers

1
Naveed Ramzan On
mysql -u username -p database_name < file.sql
1
Mike On

Issue can be related to your custom action's execution time during the installation. If the custom action is immediate, "test.sql" file you added from the Files and Folders page in your Advanced Installer project is not yet physically present on the target machine.

To fix this you can try enabling the following options for the custom action:

Execution time: "When the system is being modified (deferred)"

Execution options: "Run under LocalSystem account with full privileges (no impresonation)"