How can I find out the location of my (localdb) SQL Server 2012 database and back it up?

It is quite confusing for people who touch with Entity Framework the first time.

If you use Code First, an mdf file is generated at %USERPROFILE% (e.g. C:\Users\<username>).

If you use Database First, you create a database under SQL Server Object Explorer (not Server Explorer!), an mdf file will be generated at %LOCALAPPDATA%\Microsoft\Microsoft SQL Server Local DB\Instances\MSSQLLocalDB.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)