I have successfully dumped an entire MySQL database using
mysqldump --databases
generating a nice .txt file. However, I can’t see how to read the whole file back into MySQL in one go; mysqlimport seems to want just one table at a time.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
When you’ve generated some file (say
db-dump.sql) withmysqldump, you can import it to your other database with themysqlcommand :And, if you don’t want the password to appear in a command, you can use :
As a sidenote, if you want to copy one DB to another one, you don’t need to use a file, and can just directly pipe the output of
mysqldumptomysql:(It should even be faster, as you’re not using a temporary file that resides on disk)