As I did forced reinstall of my development environment I decided to move all my SQL Server databases to virtual disk. It seemed like a good choice, especially since I formatted virtual disk as exFAT. Since I have dual boot that means that I can use same database from both machines without dealing with all that pesky security.
Well, I was wrong. First message that greeted me was dreadful Access Denied
. SQL Server would not attach, create or otherwise do anything with anything on that drive.
I'll skip some debugging and head smacking and present you only with result: In services find SQL Server instance and change Log on as
property to Local System account
instead default of Network Service
. That will allow it access your attached virtual disk.
Security-wise Network Service
is much better account for hosting SQL Server. And in production I would definitely go with either it or separate account only for SQL Server. However, having SQL Server running as Local Service
is convenient and good enough for development environment.
P.S. Once you attach database, you can switch back to Network Service
account. It seems that error appears only on initial attach.