想要在 NSIS 中创建具有完整权限的安装 mysql 用户 [英] Want to create mysql user in installation with full Privileges In NSIS

查看:71
本文介绍了想要在 NSIS 中创建具有完整权限的安装 mysql 用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下代码但没有成功,请帮忙

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} 通过以下过程由自定义 .ini 配置获取

${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"

请告诉我哪里错了.

推荐答案

感谢 @Seki 的回复.这段代码运行良好,我在 ${password} 和 $password 以及 ${login} 和 $login 之间混淆了,这就是为什么它现在不工作的原因,我是正确的代码并且可以工作.

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

这篇关于想要在 NSIS 中创建具有完整权限的安装 mysql 用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆