Maison > Article > base de données > 修改sqlserver2008默认的数据库文件保存路径
在配置工具中,右键服务器,然后选择属性。 然后数据库设置,再配置数据库默认位置 方法二,直接使用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;">'HKEY_LOCAL_MACHINE'<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;">'Software\Microsoft\MSSQLServer\MSSQLServer'<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;">'DefaultData'<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;">'E:\YourData'<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;">'HKEY_LOCAL_MACHINE'<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;">'Software\Microsoft\MSSQLServer\MSSQLServer'<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;">'DefaultLog'<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;">'E:\YourLogs'<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>