Welcome to MSDN Blogs Sign in | Join | Help

SQL Express - User does not have permission to perform this action.

Visual Studio 2005 RTM'd yesterday which was very exciting - it's nice to install real retail bits rather than internal builds.  One of the cool new features is SQL Express - a lightweight SQL "server" that operates on database files with an .mdf extension.  Having a database file instead of a server makes things much more portable and distributable.  It's kind of like working with Access .mdb files with the full power of SQL.

After waiting an hour or so for Visual Studio 2005 Team Suite to install, I immediately created a new C# ConsoleApplication1, went to Add New Item, and attempted to add a "SQL Database" named Database1.mdf to the project.  What did I get?

Doh!  What happened?  How do I not have permission, I'm a local admin on the machine!

After contacting one of the devs in the SQL Server Engine team, he found out that even though I was a member of the local Administrators group, I was not a member of the local Users group.  It turns out that SQL Express requires the user to be a member of the local Users group either explicitly or implicitly (e.g. via "NT Authority\Authenticated Users" or "NT Authority\Interactive"). 

By default, XP adds "NT Authority\Authenticated Users" to the Users group which means anyone with a valid user name and password (including anyone in your company if you're joined to a domain) can log onto your machine.  I'm a bit protective of my machine and I don't want anyone else logging into it so one of the first things I do is clear out the Users group when I install the OS.  This of course caused the error above, but adding my specific domain account back to the Users group solved the problem without having to open up my machine to the entire domain.

Problem solved!

Published Friday, October 28, 2005 12:21 PM by kaelr
Filed under:


No Comments
Anonymous comments are disabled
Page view tracker