1

I am trying to run .sql file using Inno Setup.

[Run]
Filename: "C:\Program Files\HeidiSQL\heidisql.exe"; \
    Parameters: "-u root -p Password -h localhost --execute=""G20 Standard.sql"""; \
    WorkingDir: {app}; StatusMsg: Loading Database; Flags: runhidden

It loads the g20 standard.sql in HeidiSQL, but it's not executing that file. It gives error:

Please specify directory to watch.

I can close this error and execute file manual after.

This error coming from HeidiSQL part as HeidiSQL icon appears in Windows taskbar and I can minimise that fault by clicking on icon.

What could be that I am missing here? As it looks like error coming from HeidiSQL, should I move this question to that market instead?

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
Ruoks
  • 13
  • 4

2 Answers2

3

I do not see any --execute switch in HeidiSQL documentation --- Actually there does not seem to be any way to execute .sql script from HeidiSQL command-line.

You should use MySQL to execute your .sql:

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
-1

HeidiSQL can of course be run with an .sql file name on the command line, but you have to remove that --execute stuff around that file, and the file should have a complete path:

Filename: "C:\Program Files\HeidiSQL\heidisql.exe"; \
    Parameters: "-u root -p Password -h localhost ""{app}G20 Standard.sql"""; \
    WorkingDir: {app}; StatusMsg: Loading Database; Flags: runhidden

On the other hand, if you don't want a visible window, it makes more sense to run an .sql file through mysql.exe.

Anse
  • 1,573
  • 12
  • 27
  • But that only loads the `.sql` to HeidiSQL window. OP wants to execute the SQL (and presumably in a hidden way). – Martin Prikryl Jul 11 '18 at 15:42
  • Oh yes, you're right. Automatically *running* an .sql file is actually not possible with HeidiSQL, there is no command line parameter for that. Go and use mysql.exe instead, with endless possibilities. – Anse Jul 13 '18 at 21:06