How to attach a .sql file

We backed up our mysql databases from our ubuntu server and need to re-attach them to another server.
I believe that all I need is the .sql file and need to run the attach command from the command line.  If this is correct what is the command?  For some reason I can't find the google answer.  Thanks in advance
tofitadminAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
codezpConnect With a Mentor Commented:
I am thinking instead of attach you want to import it to new server?

Something like this works:

$ mysql -u username -p -h localhost databasename < data.sql

hope that helps
0
 
tofitadminAuthor Commented:
thanks, that worked...
I used a GUI to do that but I was thinking that you could "attach" a database but instead I had to create one and then import the .sql file
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.