How to export mysql dump in Linux?

You can export mysql database dump in Linux simple by typing:

mysqldump -u root -p databasename > filetosave.sql

Please note that -u is the user you have to specify and -p is the password. In the above case, we haven’t specified the password hence it will prompt you for it. After these fields you can specify the database you want to export or if you want to export all the databases , you can use:

mysqldump -u root -pMyPassword --all-databases > allfiletosave.sql

Now allfiletosave.sql will contain all the databases.