开发者

Change default db to Master db in SQL Server

I have deleted my default db now I can not login using sql server authentication. Ho开发者_运维技巧w can I change default db back to Master db

EDIT: I cannot login using sql server authentication. It gives me error

Cannot open user default database. Login failed. Login failed for user 'xyz'. (Microsoft SQL Server, Error: 4064)

Thanks.


Connect via SSMS. In the connection dialog box, click on the "Options >>" button and change the "Connect to database:" option to be Master instead of <default>.

Change default db to Master db in SQL Server

This should get you in. Then you can use the command below to change your login's default DB.

Exec sp_defaultdb @loginame='login', @defdb='master'


In SSMS: Server->Security->General Tab->Default Database

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜