Anyone seen this before?

CREATE DATABASE permission denied in database 'master'. An attempt to attach an auto-named database for file C:\Documents and Settings\..\App_Data\HelloWorld.mdf failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share.

I'm asking on a friend's behalf. I've sent him these links:


Yes, a previous attachment wasn't unattached properly, or it was attached manually. Go in to Management Studio connect to the database, and disconnect the long database name that looks like a file path. Then try again it should work.

Nick Berardi

My friend fixed it by just using another directory, namely C:\TEMP. I think it was just a permissions thing.

Mark Cidade
+1  A: 

Generally the user that you are using to run the SQL Server service will not have access to your personal user folders, that is why you're getting the error. You either need to change the credentials used for the service, or move the database to another folder, which did the trick in your case.

awesome! this did the trick for me ... my sqlservr.exe process was running as "NETWORK SERVICE", and my TFS workspace was mapped in my user folder. So I just added permissions for network service (full control), and it started working :-)
Joel Martinez

For me helped a lot to set this tag under system.web tag on the web.config file:

    <identity impersonate="true" userName="admin_user" password="admin_password" />

Hope this can help somebody


Yes, It really did help me. Thanks a lot Mr. Ludicco!


I was also experiencing the same Problem, finally i find Solution- SOLUTION -- Is simple Move or Cut your database from the App_Data folder to any where (e.g., Desktop) then Move or Cut back DataBase to App_Data folder. That is it..........

Hope it work!

Isfan Habib - Irfan Ahmad