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

半城伤御伤魂 提交于 2019-12-12 02:57:24

问题


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:


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$\'"' 


来源:https://stackoverflow.com/questions/30773537/want-to-create-mysql-user-in-installation-with-full-privileges-in-nsis

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!