Want to create mysql user in installation with full Privileges In NSIS

286 views Asked by At

I am using following code but did not succeed, please help

!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} & ${password} taken by a custom .ini configuration by following process

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"

Please tell where i am wrong.

1

There are 1 answers

0
Prabhat Singh On BEST ANSWER

Thanks @Seki for your reply. This code is working fine i am confuse between ${password} and $password and ${login} and $login thats why its not woking now i am correct that code and it works.

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