Copy Local Database (mdf) to a server

I'm starting to learn MVC and so far is doing well. By default MVC provides to create a database for handling
user Identity details but it is saved locally. I would like to copy the structure of the database from local to a server. I do not know where the location of the database (Local DB).
To the MVC and SQL experts, my advance thanks.
zachvaldezAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Pawan KumarDatabase ExpertCommented:
Go to the SSMS.
Connect to your LocalDB.
Take backup of your DB->then take the .bak file on the server and restore it on the server. This method will create the localDB on the server.

or you can use the generate scripts to get the create SQLs and then take that on the server and run.
0
zachvaldezAuthor Commented:
This is interesting. How would I know the name of my 'LocalDB'. Is it 'LocalDB' per se ? or some real name?
0
Pawan KumarDatabase ExpertCommented:
Go to SSMS.
Put .(dot) in the server name.
it will connect to you local sql server.
Then check for your DB name.
0
Rowby Goren Makes an Impact on Screen and Online

Learn about longtime user Rowby Goren and his great contributions to the site. We explore his method for posing questions that are likely to yield a solution, and take a look at how his career transformed from a Hollywood writer to a website entrepreneur.

zachvaldezAuthor Commented:
Ok, I found the mdf file in my project but it is save locally. I would like to get a copy of this mdf file to a server or even to my
local server. Can you provide the steps?
BTW, putting "'." in the server name didn't work. I don't know the reasoning behind that either.
0
zachvaldezAuthor Commented:
Any more interest in this question?
0
Pawan KumarDatabase ExpertCommented:
Sorry somehow i missed this.
You take your mdf file to your server and run below command in SSMS.
CREATE DATABASE yourDBName ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\YourSQLServerVersion\MSSQL\DATA\yourfile.mdf')
FOR ATTACH
GO
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
zachvaldezAuthor Commented:
Sure!
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
SQL

From novice to tech pro — start learning today.