首页  >  文章  >  数据库  >  修改sqlserver2008默认的数据库文件保存路径

修改sqlserver2008默认的数据库文件保存路径

WBOY
WBOY原创
2016-06-07 15:54:011689浏览

在配置工具中,右键服务器,然后选择属性。 然后数据库设置,再配置数据库默认位置 方法二,直接使用sql语句修改 USE [ master ] GO EXEC xp_instance_regwrite N HKEY_LOCAL_MACHINE , N Software\Microsoft\MSSQLServer\MSSQLServer , N DefaultData , REG

在配置工具中,右键服务器,然后选择属性。

然后数据库设置,再配置数据库默认位置

 

方法二,直接使用sql语句修改

<code style="margin: 0px; padding: 0px;"><span class="kwd" style="margin: 0px; padding: 0px;">USE<span class="pln" style="margin: 0px; padding: 0px;"> <span class="pun" style="margin: 0px; padding: 0px;">[<span class="pln" style="margin: 0px; padding: 0px;">master<span class="pun" style="margin: 0px; padding: 0px;">]<span class="pln" style="margin: 0px; padding: 0px;">
GO
<span class="kwd" style="margin: 0px; padding: 0px;">EXEC<span class="pln" style="margin: 0px; padding: 0px;"> xp_instance_regwrite N<span class="str" style="margin: 0px; padding: 0px;">&#39;HKEY_LOCAL_MACHINE&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;Software\Microsoft\MSSQLServer\MSSQLServer&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;DefaultData&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> REG_SZ<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;E:\YourData&#39;<span class="pln" style="margin: 0px; padding: 0px;">
GO
<span class="kwd" style="margin: 0px; padding: 0px;">EXEC<span class="pln" style="margin: 0px; padding: 0px;"> xp_instance_regwrite N<span class="str" style="margin: 0px; padding: 0px;">&#39;HKEY_LOCAL_MACHINE&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;Software\Microsoft\MSSQLServer\MSSQLServer&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;DefaultLog&#39;<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> REG_SZ<span class="pun" style="margin: 0px; padding: 0px;">,<span class="pln" style="margin: 0px; padding: 0px;"> N<span class="str" style="margin: 0px; padding: 0px;">&#39;E:\YourLogs&#39;<span class="pln" style="margin: 0px; padding: 0px;">
GO </span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></code>
声明:
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn