I've had this a couple of times and I can't find a way around it. I'm dumping a mysql database from the terminal using the following command:

mysql -uusername -p my_database > myfile.sql

When I run that and enter my password I wait and wait but nothing happens, the file myfile.sql is created but has the size of 0k. Am I missing something? Is there a better way to dump a database?


mysql is for interacting with the database.

mysqldump is what you want for this task.

| improve this answer | |

Try (for linux)

    `mysqldump -u username -p my_database > /home/chandan/Desktop/myfile.sql`

Make sure you have SELECT,SHOW VIEW,TRIGGER,LOCK TABLES privileges to run mysqldump

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.