Archive: Confirm MySql Database Password


Confirm MySql Database Password
Hi,

Part of the installation for my program requires that a MySql database be created. To do this, I ask the user for their root mysql password, and then use this to execute an SQL file to build the database.

I was just wondering if there is anyway to validate the password before allowing the user to continue with the installation. If this is possible, please let me know.

Thanks!


How is the user entering it? Is it an InstallOptions dialog?
What kind of validation are you after?

Stu


Yea, the user enters the password via Install Options dialog. I was wondering if there was a way to check the password by attempting to execute some test command in MySql and seeing if it worked. I have no idea what command I would use or how I would see if it worked though.


Well if the SQL file execution fails then you should get an error code other than 0:

ExecWait command $R0
--or--
nsExec::Exec command
Pop $R0

Either will put the error code in $R0.

Stu


Thanks, I'll give that a shot.


Ok, this is the code I am using:

nsExec::Exec 'cmd /C IF 1==1 "$mysqlexebin\mysql.exe" -uroot -popen123'
Pop $R0
${if} $R0 != 0
MessageBox MB_OK "Error: Invalid MySql Root Password. Please try again."
Abort
${endif}
This code, however, doesn't work and will not abort or display the error message when I type in a wrong password. Does anybody know what I could be doing wrong?

Thanks!

Never mind, I just got it to work.