drsmartman44
30th March 2005 17:38 UTC
MySQL Setup
Hello everyone,
I have read over a few posts that touch on my problem, but for some reason or another (most likely human error) I can't get it to work. I am running an NSIS script that includes the setup of a MySQL database, table and user. I do this via SQL run from the cmd line. See below.
mysql-uroot < "C:\Documents and Settings\username\Desktop\appName\install\mysql\scripts\create_mysql_database.sql"
In my NSIS script, I run this from a function. see below.
Function setupSchema
Exec 'mysql -uroot < "${SRC}\mysql\scripts\create_mysql_database.sql"'
>FunctionEnd
>
I have also tried various commands instead of Exec (NSExec::ExecToStack, nsExec::ExecToLog, ExecWait) and messed around with the command itself(including 'cmd' or 'command',giving a full path to 'mysql' with full quotes,etc).
Any idea why this would be working? I did review some previous posts, but nothing seems to be working. By the way, MySQL is running when this is executed and I verified the SQL works when run manually.
Also, are there any debugging options or logging that I can use to see what's going on. I know all the commands are displayed during the install...but anything more is helpful.
Many thanks in advance.
KenA
31st March 2005 13:02 UTC
Re: MySQL Setup
Originally posted by drsmartman44
Hello everyone,
I have read over a few posts that touch on my problem, but for some reason or another (most likely human error) I can't get it to work. I am running an NSIS script that includes the setup of a MySQL database, table and user. I do this via SQL run from the cmd line. See below.
mysql -uroot < "C:\Documents and Settings\username\Desktop\appName\install\mysql\scripts\create_mysql_database.sql"
In my NSIS script, I run this from a function. see below.
setupSchema
Exec 'mysql -uroot < "${SRC}\mysql\scripts\create_mysql_database.sql"'
>FunctionEnd
>
{...}
Hi, maybe you should try:
setupSchema
Exec '"mysql.exe" -uroot < ${SRC}\\mysql\\scripts\\create_mysql_database.sql'
>FunctionEnd
>
Hope this helps,
KenA
drsmartman44
31st March 2005 15:24 UTC
KenA,
Thanks for the response. I tried it the way you suggested, but to no avail. I put "mysql.exe" in quotes and took the quotes out of my .sql path although that path has spaces so it would need to be quoted. I also tried the full path to mysql.exe (C:\mysql\bin\mysql.exe).
Is there anyway I can log or view the results of this particular execution? The installer shows 'Execute: <my string above>'...but I don't know the results of that execution. Anyway, I could print it to the screen???
Sorry, I'm new at this :( Thanks again.
KenA
31st March 2005 16:04 UTC
Originally posted by drsmartman44
KenA,
Thanks for the response. I tried it the way you suggested, but to no avail. I put "mysql.exe" in quotes and took the quotes out of my .sql path although that path has spaces so it would need to be quoted. I also tried the full path to mysql.exe (C:\mysql\bin\mysql.exe).
Is there anyway I can log or view the results of this particular execution? The installer shows 'Execute: <my string above>'...but I don't know the results of that execution. Anyway, I could print it to the screen???
Sorry, I'm new at this :( Thanks again.
Ok. I assume that mysql.exe is a command line application. If so, you should be able to execute it with nsExec (it's a plug-in that I believe to be part of the standard NSIS install that deals with command line applications).
I also assume that {SRC} has been defined as "$DESKTOP\appName\install" and that the ShellVarContext is current.
setupSchema
nsExec
::ExecToLog '"C:\\mysql\\bin\\mysql.exe" -uroot < ${SRC}\\mysql\\scripts\\create_mysql_database.sql'
>FunctionEnd
>
You should be able to see the result of the function in the logwindow, to help debug the problem. You may also try a simpler path for the "create_mysql_database.sql" file to help you in the debug process.
Later, KenA
Takhir
31st March 2005 16:50 UTC
BTW ExecDos plug-in supports stdin string parameter for console application http://forums.winamp.com/showthread....hlight=ExecDos