SQL Server 2008 database engine login failed for administrator user in windows 7
Depending on what mode SQL Server was installed (Windows Authentication or Mixed Mode), you may have to do a few things. If you installed in mixed mode, you can log in as sa and add the administrator user as a Login under the Security section. Make sure you assign sysadmin role to the user, which can be found under Server Roles.
If Windows Authentication mode was chosen during install then there are a couple of things you can do, but I think the easiest is just to recreate the user sadegh, login into SQL Server as that user, and follow the previous step to add the administrator user as a login.
UPDATE: If all else fails, you can run SQL Server in Single User Mode, which allows a single connection to the server, and enable/change the sa password. To do this you can:
- Open the command prompt (Right-Click on and select "Run As Administrator")
- From the command prompt type net stop MSSQLSERVER
- Next type net start MSSQLSERVER /m
- Open SQL Server Management Studio. Do not login, cancel the login dialog.
- From the file Menu select New->Database engine query, and login (Make sure you use the host name and not localhost).
- Execute the query ALTER LOGIN sa WITH PASSWORD = ''; to reset the password (if the sa is not enabled then type ALTER LOGIN sa ENABLE to do so)
- Login with the sa user and add the Administrator user.
EDIT:
As indicated by @jimasp in the comments, for step 6 you may have to do ALTER LOGIN sa WITH PASSWORD = '' UNLOCK;, because the sa account may be locked from too many login attempts.
Tested on Windows 7 Ultimate with SQL Server 2008 Standard. Hope this helps.
Cannot login to SQL Server 2008, in Windows 7 x64
Follow the steps in Troubleshooting: Connecting to SQL Server When System Administrators Are Locked Out:
- Start the instance of SQL Server in single-user mode by using either the -m or -f options.
- Start command prompt as local administrator
- Connect to the server:
sqlcmd -E -S .
Add yourself (computername\username) to the sysadmin SQL group:
create login [computername\username] from windows;
exec sp_addsrvrolemember 'computername\username', 'sysadmin';
Restart the server in normal mode
And next time pay attention to the options you click during Setup.
Unable to log in to server in SQL Server 2008 R2 Management Studio
You need to add a server login:
- Connect to your SQL Server with SSMS as
sa
. - Drill into the server's Security folder in SSMS's Object Explorer pane.
- Right-click on the server's Security > Logins folder that appears in Object Explorer.
- Click on New Login... in the context menu that appears.
- Provide details of the new login in the Login - New dialog that opens - particularly its General, Server Roles, and User Mappings pages (along the left). (See the screenshots of each page with sample input at the bottom of the answer.)
You may need to add a database user depending on your needs, but a server login (like your sa
login) is necessary to connect to the SQL Server instance using Windows or SQL Server authentication. Mapping the new login to a database user (in the Login - New dialog's User Mappings page) will create a new user in the mapped database if you specify a username that does not already exist; alternatively you can map the new login to an existing database user.
Another SO question speaks to the differences between server logins and database users.
Login - New (General page)
SQL Server authentication
or
Windows authentication
Login - New (Server Roles page)
Login - New (User Mappings page)
SQL Server authentication
or
Windows authentication
Login to Microsoft SQL Server Error: 18456
If you're trying to connect using "SQL Server Authentication" then you may want to modify your server authentication:
Within the Microsoft SQL Server Management Studio in the object explorer:
Right click on the server and click
Properties
Go to the
Security
pageUnder
Server authentication
choose theSQL Server and Windows Authentication mode
radio buttonClick
OK
Restart SQL Services
Connecting microsoft sql server 2008 r2 to netbeans IDE 7.0 error 18456 severity 14 state 38 login failed
It was a bug in Netbeans's installation. It wasn't fixed even after update. I uninstalled and downloaded the latest netbeans ide, which is 7.2.1, and when I tried it worked without any problems at all.
Related Topics
Undelete Recently Deleted Rows SQL Server
Can You Have an Inner Join Without the on Keyword
How to Use T-SQL Full-Text Search to Get Results Like Google
Why Is My Left Join Not Returning Nulls
Rails Order by Association Field
Get the List of Stored Procedures Created And/Or Modified on a Particular Date
Running a SQLite3 Script from Command Line
How to Best Handle the Storage of Historical Data
Oracle SQL Order by in Subquery Problems!
Varchar(255) V Tinyblob V Tinytext
Optimising a Select Query That Runs Slow on Oracle Which Runs Quickly on SQL Server
Sqlplus Spooling: How to Get Rid of First, Empty Line
Quickest/Easiest Way to Use Search/Replace Through All Stored Procedures
Ant SQL Task: How to Run SQL and Pl/Sql and Notice Execution Failure
How to Create a SQLite3 Database File Using a SQL Command File