Friday, March 18, 2016

How to export a mysql database using Command Prompt

Some how my PhpmyAdmin stopped working And I had to take up a back up of one of my databases. So that time,  I thought of using the Mysql Command prompt service. 

To take the back up, we can export the tables and contents of the database using mysqldump.  Please note that mysqldump is not a command from mysql. It's a utility provided by MySql to export the contents. So it does not work from the mysql command. If you use it in mysql prompt you get the below error:


So you need to go to the place where my sql is installed and can see mysqldump.exe


Now go to this place using the command prompt and execute the below command:

mysqldump -u root -p mrms >mrms.sql

Here mrms is name of the database. It prompts for the root password. Enter the root password and then the mrms.sql is generated in that directory.

 

That's it. Happy Coding.

No comments: