server|sqlserver| Error | data | database
Unable to open the user default database , logon failed, which is one of the problems that SQL Server users are familiar with. When using Enterprise Manager, Query Analyzer, various kinds of tools and application software, as long as the connection to the SQL Server database, it is possible to encounter this problem, causing this error occurred more than the reason, let us analyze the cause of the problem and the solution.
First, why
The default database for the login account is deleted.
Second, the solution:
(a), using the Administrator account to modify the default database for this account
1, open Enterprise Manager, expand the server group, and then expand the server
2. Expand "Security", expand Login, right-click the corresponding login account, select from the pop-up menu, properties
3. Re-select the default database for this login account
(b), if there is no other administrator login account, can not be modified in Enterprise Manager, using the isql command line tool
isql/u "sa"/P "sa password"/d "master"//"EXEC sp_defaultdb n ' sa ', n ' master '"
If you use Windows authentication, use the following command line to change the default database to a database that is not missing:
isql/e/d "Master"/q "exec sp_defaultdb n ' BUILTIN\Administrators ', n ' master '"
(2) SQL Server cannot start because the system password has been changed
The solution is: Click Run, type services.msc, open the service program, locate the SQL Server project, select the property item bis-' Login ', change the login password to the operating system Administrator account login password, restart SQL Server, you can start normally.