LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 02-25-2008, 10:14 AM   #1
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Rep: Reputation: 30
mysql dump


Hi does anyone know how to exclude a database from a mysql dump
or if you can use mysqldump to dump database that are in file list
for example i have a list of all the database i want to dump in a file can i use mysqldump to look into the file and use the list to do the dump
 
Old 02-25-2008, 10:23 AM   #2
mtimbro
Member
 
Registered: Feb 2008
Location: Montreal, Canada
Distribution: RedHat 3/4, Ubuntu 7.10
Posts: 86

Rep: Reputation: 15
mysqldump

Quote:
Originally Posted by mahmoud View Post
Hi does anyone know how to exclude a database from a mysql dump
or if you can use mysqldump to dump database that are in file list
for example i have a list of all the database i want to dump in a file can i use mysqldump to look into the file and use the list to do the dump
From what I can read, either you specify each DB or all the DB's:

>mysqldump [options] --databases DB1 [DB2 DB3...]
>mysqldump [options] --all-databases

Hope this helps,
 
Old 02-26-2008, 03:59 AM   #3
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
i want to exclude a database from mysql dump
 
Old 02-26-2008, 06:24 AM   #4
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
mtimbro is exactly right. You cant exclude. You must include those you want to backup instead.

Code:
USER=user;
PASS=pass
HOST=host;
EXCLUDE=exludeddb
#********

MYSQL=$(mysql -N -u${USER} -p${PASS} -h${HOST} <<<"SHOW DATABASES" | grep -v ${EXCLUDE} | tr "\n" " ")

mysqldump -u${USER} -p${PASS} -h${HOST} --databases ${MYSQL}
 
Old 02-26-2008, 07:48 AM   #5
my_seagul
LQ Newbie
 
Registered: Feb 2008
Location: Finland
Distribution: Fedora Core
Posts: 9

Rep: Reputation: 0
I have been using this backup-script for quite a while now in many production environments:

http://www.debianhelp.co.uk/mysqlscript.htm

Deleriux's script is handy, but if you need to get mysqldump regularly, this might come handy.
 
Old 02-26-2008, 08:23 AM   #6
Deleriux
Member
 
Registered: Nov 2003
Posts: 89

Rep: Reputation: 17
Well, I woudlnt call the above a proper script so to speak, just a means of excluding 1 database when doing a mysqldump.

Seagull is right though - it might be more beneficial for you to take advantage of a prewritten script which is capable of customization to your particular needs.
 
Old 02-26-2008, 05:10 PM   #7
choogendyk
Senior Member
 
Registered: Aug 2007
Location: Massachusetts, USA
Distribution: Solaris 9 & 10, Mac OS X, Ubuntu Server
Posts: 1,197

Rep: Reputation: 105Reputation: 105
Or, if you wanted to do some serious management of mySQL dumps, you could adopt Zmanda Recovery Manager (ZRM) for MySQL:

http://www.zmanda.com/backup-mysql.html

It's open source and free, so you can download it and use it. Zmanda also provides commercial enterprise support.
 
Old 02-27-2008, 02:43 AM   #8
mahmoud
Member
 
Registered: Apr 2006
Location: UK
Distribution: Mandriva, Debain, Redhat, Fedora, Ubuntu, FreeBSD
Posts: 269

Original Poster
Rep: Reputation: 30
thanks guys i put those commands in a script and it worked fine
its just a one time dump
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
mysql dump extraction noir911 Linux - Server 10 04-20-2007 07:46 PM
Using cronjobs to mysql dump and scp backup to another box daiver Linux - General 4 11-10-2006 07:37 AM
MySQL :: Restoring Dump Swakoo Linux - General 6 09-09-2005 01:27 AM
Mysql with 10.2 dump barrythai Mandriva 2 04-11-2005 07:18 PM
How do I get a dump file (.sql) into MySql? TreeDragon60 Linux - Software 4 03-21-2004 05:19 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 05:43 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration