SQL Server – Logging in Without ‘Run as Administrator’ on Windows 7

Securitysql serversql-server-2008windows 7

When I start Management Studio, unless I use the "Run as Administrator" selection, I cannot login to my local SQL Server. Is this normal? I am a normal developer and don't believe I have a need for high security on my local machine.

I'm running SQL Server 2008, Windows 7.

The error I get is:

Cannot connect to (local)
Additional Information
Login failed for user 'MYCOMPUTER\MyName'. (Microsoft SQL Server, Error: 18456)

This seems to be a reoccurring theme because when I run visual studio, I have a similar login failure when I run database accessing code. Optimally, I would like a solution that solves both cases.

Best Answer

Most likely your problem is that your database is setup to only have logins defined for administrative users. Go into Management Studio as an admin user, and go to the Security -> Logins category. You probably only have some built in SQL users, and SERVERNAME\Administrators.

Right click the Logins category, and choose "New Login..." - from there you can add your non-admin user SERVERNAME\MedicineMan and give it the sysadmin server role. This will give it admin rights to the database while leaving it as a normal user on the Windows system.