+ Reply to Thread
Results 1 to 7 of 7

Thread: Running MySQL.exe on setup to create a database

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Andy Guest

    Default Running MySQL.exe on setup to create a database

    Hello,
    I've searched the forum and couldn't find what I was looking for.
    My problem is running a MySQL script after the setup to create a database and the tables.
    I tried it with the "run commandline" and the "run programm" function but none of them worked.
    To execute the script I use mysql.exe with the parameters -u %USER% -p %PASSWORD% -h %SERVER% < "script.sql"
    If I run this line directly into the cmd it works as expected and the database is created but not so out of the installer.

    Can you give me a hint, what i'm doing wrong?
    I use the SetupBuilder v7.1 Dev on WinXP
    The command line string is "%_SB_INSTALLDIR%\MySQL\mysql.exe" -u %USER% --p %PASSWORD% -h %SERVER% < "%_SB_INSTALLDIR%\MySQL\CreateDatabase.sql".
    I don't know what to do or what i could try.

    Thanks!
    Andy

  2. #2
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Running MySQL.exe on setup to create a database

    Andy,

    I don't think that your command line is correct at all. Please note that a Windows application (e.g. your setup.exe) makes use of CreateProcess or ShellExecuteEx Windows APIs to launch another program.

    Friedrich

  3. #3
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Running MySQL.exe on setup to create a database

    BTW, perhaps your intention was to run the command interpreter? In this case you have to use cmd /c in front of your command.

    Friedrich

  4. #4
    Unregistered Guest

    Default Re: Running MySQL.exe on setup to create a database

    Quote Originally Posted by linder View Post
    BTW, perhaps your intention was to run the command interpreter? In this case you have to use cmd /c in front of your command.

    Friedrich
    Yes, exactly. Sorry about that.
    That means i have to do launch the mysql.exe with "run programm"? Ok, i'll give it a try.
    Thank you for your advice.
    Now, all i have to do is to find out, how to pass the parameters correctly to the call.

    Thanks!
    Andy

  5. #5
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Running MySQL.exe on setup to create a database

    Hi Andy,

    IMO, "Run Command Line..." should also work for you. But you have commands in your command line that are typical for a "command interpreter" call. For example, "<" is a redirection operator and only available in CMD.EXE. Neither the CreateProcess nor the ShellExecuteEx Windows API have any idea what "<" means.

    So just put cmd /c in front of your original command line and you should be done. This will then launch the command interpreter (CMD.EXE).

    Does this help?

    Friedrich

  6. #6
    Andy Guest

    Default Re: Running MySQL.exe on setup to create a database

    Hi Friedrich

    Hey, it' working right now.
    Thank you!
    You were right to put the cmd /c in front of the command line.
    Whats a little bit strange is, is the fact that it doesn't work if you call it with "cmd.EXE /c" or "[SYS]\cmd.exe /c".
    It has to be "cmd /c".

    Andy

  7. #7
    Join Date
    Mar 2004
    Posts
    4,307

    Default Re: Running MySQL.exe on setup to create a database

    Hi Andy,

    Perfect!

    Friedrich

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts
  •