NYCPHP Meetup

NYPHP.org

[nycphp-talk] Re: can mysqldump exclude a database?

Faber Fedor faber at linuxnj.com
Thu Oct 28 23:36:33 EDT 2004


On 28/10/04 22:57 -0400, Daniel Convissor wrote:
> Hey Folks:
> 
> mysqldump -A will export all of the databases.  But, what if I want to 
> exclude a particular database?  Is it possible?  How, please?
> 
> I looked at the documentation and the --help output.  I'm hoping 
> there's an undocumented option. :)

Come to think of it, you could do this:

ls -al $mysql_dir  | grep ^d  | egrep -v '\.[\.]?' | grep -v $test | awk '{
mysqldump $9 }' | sh

where $mysql_dir is the directory wherein your mysql databases reside
and $test is the directory/database you don't want.

For those of you who don't read shell, the command line reads:

list all files in the mysql directory | show only the
directories/databases | do not show the . and .. directories | don't
show the $test directory/database | print out the statement "mysqldump
directory" |  pass those strings to the shell for execution.


Simple, no? :-)


-- 
 
Regards,
 
Faber                     

Linux New Jersey: Open Source Solutions for New Jersey
http://www.linuxnj.com






More information about the talk mailing list