MySQL dump/import command
-
I am not interested in a collection of links to sites that offer all sorts of explanations of all the command line switches for doing this (I could find these myself). I want a researcher who knows the answer with confidence to respond to this question with brevity/clarity and most importantly, accuracy in mind. I have two MySQL databases located on a server somewhere. I connect via secure shell. I don't know all of the details about the configuration of this particular server but it obviously has MySQL installed/configured properly and you can assume that any other 'very likely' items would also be resident. I need to completley copy one database into the other (one is currently quite large, the second is empty). I know I have done dumps in the past with this sort of thing: mysqldump -u USER -pPASSWORD DATABASE > filename.sql so perhaps my primary question is how do I import this dump into the second database. I have had very little luck with the "mysqlimport" command - which the MySQL documentation states is for importing text files (which the sql dump seems to be) but it is not of simple delimitation (if thats a word). I should note that while the two databases exist on the same server the username/passwords for them are different. I ask because I am pressed for time and need to get this small detail out of the way and don't have time to play around with it. If your answer does the trick for me, you get the money and a good rating.
-
Answer:
Hello, I manage a couple forums in MySQL which have different tables & data which need to be backed up and every now and again restored. Here's the simple command to restore the database using the file you dumped in the first step: mysql -u USER -p DBNAME < dump.sql You might have to make sure the database you're importing into is EMPTY because the import command listed above will not overwrite structures existing already. Use PHPMyAdmin or another set of delete/remove table commands to make sure the structures you're importing do not already exists in the database you're importing into. Other than that, it's simple as pie. Additional Links: http://www.he.net/faq/mysql.html#Anchor1020 Search Strategy: mysql dump restore on google: ://www.google.com/search?q=mysql+dump+restore Thank you for the opportunity to answer your question, if you require more information, please clarify the question, or if you find this answer satisfactory, please feel free to rate it. Thank you! skermit-ga
mork-ga at Google Answers Visit the source
Related Q & A:
- How To Run A Command In Ubuntu?Best solution by Yahoo! Answers
- How to clear the command history in the console?Best solution by blender.stackexchange.com
- How to dump an HBase table?Best solution by Stack Overflow
- How do you do a screen dump?Best solution by Yahoo! Answers
- What is the difference between internal command and external command in Linux?Best solution by answers.com
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.