Thomas’ Developer Blog

April 2, 2008

MySQLDump

Filed under: sql — Tags: , , , , — sanzon @ 4:10 am

There are already a few blogs out there that include information about mysqldump, but one thing they always fail to include is that you have to run the program as an admin and how to get to the file through DOS.

MySQLDump is a file included with mysql in order to backup your table structures and data so that it can be transfered or saved for a backup.

To start you simply go to your start menu and access the command prompt “CMD.”

 NOW THIS IS IMPORTANT.  It caused me a few hours of pulling hair to get it straight!

RIGHT CLICK CMD AND RUN AS ADMIN.  You must run the dos prompt as an admin!  Or else you won’t be able to save the dump file!

Once you have opened DOS as an admin you can simply browse to the mysql folder.

The easiest way to do this is to just use the CD and DIR commands.  CD.. to C:\ root, then go on ahead and use CD Program Files, CD mySQL w/e.  It’s very basic.

Once you get into the main mySQL directory you must access your version of SQL you are using and go into the BIN directory.  Inside fo the bin directory is the mysqldump.exe file!

Now once you are setup in the bin folder with the mysqldump.exe file you simply type:

mysqldump -u[username] -p[password] [database] > [directory.filename]

example:
mysqldump -uroot -pmypassword mydatabase > c:\mydatabase.sql

Easy!  You can also included the opt option by simply typing –opt right after mysqldump

the –opt option stands for optimize.  Basically it creates a set of options to drop a table if it exist then recreate it again.  It’s the fastest way to do it.

Anyway it is very simple to do, and remember to not use a space after -p or -u.

Well good luck!

Advertisements

1 Comment »

  1. Thanx for everything .This helped me a lot for managing distributed database for my application.

    Comment by kumar gaurav singh — October 29, 2009 @ 4:00 pm


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: