使用引导的 SQL Express 创建数据库

发布于 2024-09-12 02:54:36 字数 475 浏览 2 评论 0原文

我编写了一个应用程序,它使用 Wix 3.5 安装程序引导 SQL Express 2008,然后尝试在首次运行该应用程序时创建数据库。因此,SQL Express 的安装是完全无人值守的。当安装应用程序的帐户是计算机上的管理员时,这一切都可以正常工作。

然而,毫不奇怪的是,以非管理员身份安装时会出现问题。当我们尝试运行 CREATE DATABASE sql 时,它会发出声音 -

sql express 2008 在数据库“master”中创建数据库权限被拒绝

显然标准用户帐户没有正确的权限。因此,我们需要以某种方式授予标准用户正确的权限。我曾考虑过捆绑一个单独的可执行文件,该可执行文件被迫以管理员身份运行(通过 UAC),这将创建数据库并将新数据库的权限分配给用户帐户 - 这不是一个非常优雅的解决方案。

这似乎是部署应用程序时您想要做的显而易见的事情,但似乎缺乏有关该主题的信息。寻找建议 - 谢谢。

I've written an app which bootstraps SQL Express 2008 with a Wix 3.5 installer, then attempts to CREATE DATABASE on first run of the app. The install of SQL Express is thus totally unattended. This all works fine when the account installing the app is an Administrator on the machine.

However, somewhat unsurprisingly, problems arise when installing as non-admin. When we try to run CREATE DATABASE sql it squarks -

sql express 2008 create database permission denied in database 'master'

Obviously the standard user account doesn't have the correct privilege. So somehow we need to grant the standard user the correct privs. I have thought of bundling a separate executable which is forced to run as Admin (via UAC) which would create the database and assign privileges on the new database to the user account - not a very elegant solution.

This seems like an obvious thing you'd want to do when deploying an app but there seems to be a dearth of information on the subject. Looking for suggestions - thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

有木有妳兜一样 2024-09-19 02:54:40

事实证明,您可以使用 WiX 和 SQL 扩展来完成所有这些工作。

http://www.tramontana.co.hu/wix/lesson7.php# 7.1

Turns out you can do all of this with WiX, with the SQL Extension.

http://www.tramontana.co.hu/wix/lesson7.php#7.1

凉薄对峙 2024-09-19 02:54:39

安装应用程序时,一个相当常见的先决条件是,您需要成为安装该应用程序的计算机的管理员。为什么你不能把它作为先决条件呢?大多数系统管理员无论如何都不希望他们的非管理员用户安装应用程序。

It is a fairly usual prequisite that when installing an app, you need to be an administrator on the machine you are installing it. Why can you simply not make it a prequisite? Most sysadmins don't want their non admin users installing apps anyway.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文