Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where are my Local SQL Server Express Database Files?

I read that my Local SQL Server Express Database Files should be located here (since user on my machine is "bclay"):

C:\Users\bclay\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB

...but that can't be, as the newest file there is over 2 months old, and I updated SQL Server Express data today (via my C# Winforms app, created with Visual Studio 2019). How can I sleuth out where those files are, so I can back them up?

UPDATE

Using the answer from marc_s, I was able to get that from Visual Studio's Server Explorer:

enter image description here

UPDATE 2

Okay, this seems bizarre: I navigate to that location in Windows Explorer, and it won't show me what's in the \Data subfolder. Although I have selected the Data subfolder, it is showing me what's in the Installs subfolder below it, and when I right-click the Data subfolder to czech out its properties, it tells me I don't have the credentials to view it:

enter image description here

How can I backup the .mdf file if I can't even see it?

UPDATE 3

I did a hard-drive-wide search for all *.mdf files, and it does not "find" (show me) my tables. The only ones that could be related are the top ones here, but they have generic names:

enter image description here

UPDATE 4

I think it was marc_s that mentioned somewhere to use MS SQL Server Management Studio, and to select Task > Backup. I downloaded/installed it, and it seemed to work: it did create a Backup folder in the expected location. I see that it was created today, 10/1/2020, but I still can't see anything in the folder, thus I can't copy anything from it. Here's what I see (the contents of the last-selected folder) when I select the "Backup" folder:

enter image description here

like image 311
B. Clay Shannon-B. Crow Raven Avatar asked Dec 30 '25 12:12

B. Clay Shannon-B. Crow Raven


1 Answers

In SSMS, if you're connected to the database in question, you can run this query

SELECT * 
FROM sys.database_files

and the physical_name column in the result set will show you the path of the files in question

like image 148
marc_s Avatar answered Jan 02 '26 09:01

marc_s



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!