How to create a login to a SQL Server instance?(如何创建对 SQL Server 实例的登录?)
问题描述
我用 WiX 3.8 制作了一个引导程序项目.作为安装 SQL Server Express 2012 的先决条件,将SQLExpress"设置为新 SQL Server 实例的名称.然后在 MSI 我想创建一个新的 SQL 用户登录.我用用户元素试过这个,但它似乎不起作用.当我查看 SQL Server 管理工具中的登录信息时,我看不到我的新用户,但我的 MSI 日志告诉我,他是创建的.
I have made a bootstrapper-project with WiX 3.8. As a prerequisite SQL Server Express 2012 is installed, setting "SQLExpress" as name of the new SQL Server instance. Then in the MSI i want to create a new SQL user login. I tried this with the User-element, but it doesn't seem to work. When i take a look to the logins in the SQL Server Management tool, i can't see my new user, but the log from my MSI tells me, that he was created.
我的用户元素版本有问题还是需要我换一种方式?
Is there something wrong with my version of the User-element or have i to take another way?
<Component Id ="CreateUserAccount"
Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
Directory="TARGETDIR">
<util:User Id ="SQLUser"
Name="[DBUSER_PROP]"
Password="[DBPW_PROP]"
UpdateIfExists="no"
CreateUser="yes"
PasswordNeverExpires="yes"
PasswordExpired="no"
RemoveOnUninstall="no"
Domain="[ComputerName]">
</util:User>
</Component>
推荐答案
在 Windows-installer-xml-wix-toolset 的 Phill Hogland 的帮助下,我找到了解决方案.这取决于 PC 上使用的语言.在我的情况下,这是德语,这意味着无法通过名称Users"找到用户组,而是Benutzer".
With the help of Phill Hogland from Windows-installer-xml-wix-toolset i have found the solution. It depends on the language used on the PC. In my case that's german, which means, the group Users cannot be found by the name "Users" but "Benutzer".
这里是正确的代码:
<util:Group Id="Users"
Name ="Benutzer"
Domain="[ComputerName]" />
<Component Id ="CreateUserAccount"
Guid="AEE91491-99FA-40A9-AB47-1E9FC2DDEF2A"
Directory="TARGETDIR">
<util:User Id ="SQLUser"
Name="[DBUSER_PROP]"
Password="[DBPW_PROP]"
UpdateIfExists="no"
CreateUser="yes"
PasswordNeverExpires="yes"
PasswordExpired="no"
RemoveOnUninstall="no">
<util:GroupRef Id ="Users" />
</util:User>
</Component>
进一步您可以用包变量替换硬编码的名称.然后你将独立于操作系统语言.
Further You can replace the hardcoded name by a bundle-variable. Then You will be independent from the OS language.
这篇关于如何创建对 SQL Server 实例的登录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何创建对 SQL Server 实例的登录?
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- SQL 临时表问题 2022-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 更改自动增量起始编号? 2021-01-01
