想要在NSIS

时间:2015-06-11 06:45:54

标签: mysql windows windows-installer nsis

我使用以下代码但没有成功,请帮助

!define deflogin root
!define defpassword mysqlpassword
!define HOSTPORT "%"


ExecWait '$folder\bin\mysql --user=${deflogin} --password=${defpassword} --execute="grant all privileges on *.* to $\'${login}$\' @ $\'${HOSTPORT}$\' identified by $\'${password}$\'"' 

${login}&通过以下过程

通过自定义.ini配置获取${password}
Function .onInit 
   InitPluginsDir
   !insertmacro INSTALLOPTIONS_EXTRACT "database_details.ini"    
   !insertmacro INSTALLOPTIONS_WRITE "database_details.ini" "Field 2" "State" "${login}"
   !insertmacro INSTALLOPTIONS_WRITE "database_details.ini" "Field 4" "State" "${password}"
  FunctionEnd

  ReadINIStr $login "$PLUGINSDIR\database_details.ini" "Field 2" "State"
  ReadINIStr $password "$PLUGINSDIR\database_details.ini" "Field 4" "State"

请告诉我哪里错了。

1 个答案:

答案 0 :(得分:0)

感谢@Seki的回复。这段代码工作正常我在$ {密码}和$密码以及$ {login}和$ login之间混淆,这就是为什么它现在没有工作我是正确的代码并且它有效。

 ExecWait '$folder\bin\mysql --user=${deflogin} --password=${defpassword} --execute="grant all privileges on *.* to $\'$login$\' @ $\'${HOSTPORT}$\' identified by $\'$password$\'"'