pisymbol
23rd May 2006 00:04 UTC
Starting/configuring MySQL woes, help!
I have looked at many many posts regarding installation of MySQL as well as looking at the sample code up on Sourceforge.
My problem is not that I can't do install it, its that I'm getting different results depending on target machine (variables such as FireWall/security software I believe are not a factor).
Here is my script to start and configure MySQL:
# Start MySQL
DetailPrint "Starting MySQL Configuration..."
ExecCmd::exec /NOUNLOAD /ASYNC `"$INSTDIR\mysql-5.0.20a-win32\bin\mysqld-nt.exe"`
Pop $0 ; return value
DetailPrint "Starting MySQL Daemon returned $0"
${If} $0 != "error"
# Load it
DetailPrint "Loading schema..."
ExpandEnvStrings $0 "%COMSPEC%"
NsExec::exec `"$0" /C $INSTDIR\mysql-5.0.20a-win32\bin\mysql.exe -u root < $INSTDIR\mysql-5.0.20a-win32\my_ddl.sql`
Pop $0 ; return value
DetailPrint "Schema loading returned $0"
StrCmp $0 "0" 0 DatabaseSchemaFail
DetailPrint "Schema load successful!"
${Else}
DatabaseSchemaFail:
MessageBox MB_OK "Install failed to load database schema. Please see documentation on how to load schema file manually!"
${EndIf}
Can someone tell me if they see something glaringly wrong? I've noticed that I can not use Exec or NsExec to start mysqld since it just hangs waiting which seems wrong based on the doc (I would assume it should fork a child process and continue).
When it fails, it seems that the schema load fails, i.e. mysql starts but then the schema instantly fails. Occasionally on some boxes when this occurs the mysqld process dies as well. On my machine it works everytime, on other machines it fails miserably.
Does anyone know what's going on or have seen this type of behavior before?
Thanks!
pisymbol
23rd May 2006 03:28 UTC
Btw, if anyone is doing this and has a *known* way please post!!! :-)!
RobGrant
23rd May 2006 08:41 UTC
Exec shouldn't hang around waiting (block), but nsExec should. I wonder if it's the nsExec call that's the problem: is it failing depending on what version of Windows you run it on? It could be that different versions handle command-line stuff slightly differently.
Oh actually you can only install it on NT boxes can't you, otherwise the mysql version is wrong.
pisymbol
23rd May 2006 15:17 UTC
Thanks Rob, yes this is only NT.
Exec most certainly hangs around when executing mysqld or mysqld-nt.exe with 5.0.20a. I think there is a real bug either in my syntax or within NSIS.
It seems in the majority of cases, mysqld starts fine, but the schema loads fails. It doesn't make sense to me.
Has anyone installed and loaded schema MySQL successfully on more than one machine before?
Red Wine
23rd May 2006 17:46 UTC
The way you're using LogicLib is wrong.
${If} $0 != "error"
# Load it means install it, right?
............
StrCmp $0 "0" 0 DatabaseSchemaFail
DetailPrint "Schema load successful!"
${Else}
DatabaseSchemaFail:
MessageBox MB_OK "Install failed to load database schema. Please see documentation on how to load schema file manually!"
${EndIf}
pisymbol
23rd May 2006 17:55 UTC
Originally posted by Red Wine
The way you're using LogicLib is wrong.
${If} $0 != "error"
# Load it means install it, right?
............
StrCmp $0 "0" 0 DatabaseSchemaFail
DetailPrint "Schema load successful!"
${Else}
DatabaseSchemaFail:
MessageBox MB_OK "Install failed to load database schema. Please see documentation on how to load schema file manually!"
${EndIf}
Yes, but I don't see how I'm using it wrong?
If the return code does NOT equal an error, load the schema, else we can't load the schema and move on.
I should mention that logically it a flows fine...I do get to the load schema print but the loading of the schema line fails sometimes. Its really really weird.
Can anyone tell me why Exec doesn't work for mysqld?
pisymbol
24th May 2006 23:15 UTC
For any other MySQL install stuckees...the fix is to add a --console to the mysqld-nt.exe line. For some reason, on some machines you need the --console and others you don't. With --console, it now works everytime.