How to dump your mysql database through command line

Mysql Database
I have a problem with my snort database. I have run snort for a few month, and the data logged have reach of to 400MB of alert. So, now, I want to download it back to my own pc, so that I can navigate through it faster, instead of using the slow internet connection, navigating using ACID interface..
I deal with mysql using command line interface, to backup and restore mysql database.

At first I issue this command in shell:
su-2.05b# mysqldump -a -u db_username -p db_name > snort_report.sql

It will then ask you the password of database user, enter it, and it will dump the database into the file, snort_report.sql
I actually cannot the run the command immediately, it tells the command was not found. I issue a command,

su-2.05b# which mysqldump

and it will then show you the true path of mysqldump.

Then I can download the file using Internet Download Manager, for faster download using direct link.

To restore back the file into the database, use this command:

su-2.05b# mysql -u USERNAME -p DATABASE < FILENAME.mysql

Hope this help you to do backup and restore for your database.

With free web hosting, going about marketing is much easier, particularly when there are only a few online jobs left as all are availing adsl.

Leave a Reply

Your email address will not be published. Required fields are marked *