Webmaster Forum
Go Back   Webmaster Forums UK SEO SEM Webmaster Community Forum > Web Design and Website Development > Programming > MySQL Forums
Register FAQ Members List Downloads Calendar Search Today's Posts Mark Forums Read Webmaster Resources Webmaster Blogs

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-03-2008, 05:33 PM
dman_2007
Guest
 
Posts: n/a
iTrader: / %
Default Tip : Backing up mysql database using mysqldump

Mysql server comes with a hadny command line tool called mysqldump, which you can use to backup your mysql databases. The most simple example is given below :

Code:
mysqldump -u sampleuser -p sampledb > samplefile
After entering this command, mysqldump will first prompt you to enter password for user 'sampleuser'. After mysqldump will connect to the mysql server running on your local machine and will try to log in using the username and password provided. After a successful login it start reading data stored in db 'sampledb' and printing that data as sql statements to the standard output. but since we have redirected the standard output to the file 'samplefile', those statements will be written into that file. Once the process is complete, you can use the file 'samplefile' to recreate and restore 'sampledb' should the need arise.

Another use full option is -h, which you can use backup data from remote mysql server. For exaple :

Code:
mysqldump -u sampleuser -p -h mysql.example.com sampledb > samplefile
If you want to backup only few selected tables from a database, you can specify their name after the database name. For example :

Code:
mysqldump -u sampleuser -p -h mysql.example.com sampledb table1 table2 > samplefile
If you want to backup multiple databases at once then use -B options and specify the names of all the databases you want to backup :

Code:
mysqldump -u sampleuser -p -h mysql.example.com -B sampledb1 sampledb2 sampledb3 > samplefile
Need to back up only database structure without the data, use -d option :

Code:
mysqldump -u sampleuser -p -h mysql.example.com  - d sampledb
On the other hand if you only want to save the data, without the table structure use -t option :

Code:
mysqldump -u sampleuser -p -h mysql.example.com -t sampledb > samplefile
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Stumble this Post!
Reply With Quote
Reply


Useful Resources & Sites
Search Engine Marketing Company
UK Web Hosting
Build One Way Links
 
 
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 01:56 PM.

UK Webmaster World Forums - Internet marketing, web development, domain names, SEO contest and discussuons.
Subscribe to our feeds   Subscribe to our feeds

Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0