在安装程序中装载 SQL Server Express .mdf 文件的最佳方法是什么?
安装需要 SQL Server Express 的软件的首选方法是什么?您是否应该使用安装该软件的管理员创建的新帐户来安装数据库?
如果我们使用 SA 帐户,则在安装时没有问题,但在运行时会出现错误,表明 LDF 文件存在问题。
What is the preferred method for installing software that requires SQL Server Express? Should you mount the database using a new account created by an admin that installs the software?
If we use the SA account there is no problem at install time, but at runtime there is an error indicating an issue with the LDF file.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
谢谢斯科特提出的精彩问题。确保 SQLExpress 对包含数据文件的部署文件夹具有读、写、修改访问权限。接下来,您需要确保访问您的应用程序的所有用户都可以修改数据。您可以授予完全访问权限,但不建议这样做。相反,创建一个本地 SQL 用户帐户并授予该用户修改数据库的能力。接下来确保 SQL 实例已设置为混合模式登录
作者:
如果 SQL 用户有能力修改目录,上面将创建该日志文件!
现在授予创建的用户:
现在将该用户添加到您希望的所有角色,例如:
您可以选择对该用户执行其他操作。但这取决于您想要实现的目标。
最后一步是通过以下方式使用此新帐户连接您的应用程序:
连接字符串:
Thank you Scott for your excellent question. Ensure that SQLExpress has read, write, modify access to the deployment folder which contains the datafile. Next you need to make sure that all users who access your application may modify the data. You could grant full access, but this is not advised. Instead create a local SQL user account and grant the user the ability to modify your database. Next ensure that the SQL instance has been set up to a mixed mode login
By:
The above will create that log file if the SQL users have the ability to modify the directory!!
Now grant the user created By:
Now add that user to all the roles you wish, example:
There are other actions which you may choose to take on the user. But this depends on what your trying to accomplish.
The last step is to connect your application using this new account by:
Connection string:
我应该说“如果 SQL 用户有能力修改目录,上面将创建该日志文件!!”
在运行时以管理员身份执行该代码的行为将创建日志文件;)
I should say "The above will create that log file if the SQL users have the ability to modify the directory!!"
The act of executing that code as the administrator at run time will create the log file ;)