LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 12-14-2011, 08:33 PM   #1
jmc1987
Member
 
Registered: Sep 2009
Location: Oklahoma
Distribution: Debian, CentOS, windows 7/10
Posts: 893

Rep: Reputation: 119Reputation: 119
mysqldump All data bases into several sql files


I have a task a friend and I am trying to figure out. Can you dump all the databases out of mysql into sql files per data base? I mean the only thing I seem to know or can find is that you can dump 1 by 1 or dumb all into 1 file. We want them all into several files.

Any tips?

Thanks


update:
This looks like something a script would have to do in a foreach statment or something but if you have any ideas please feel free to post.

Last edited by jmc1987; 12-14-2011 at 08:54 PM.
 
Old 12-15-2011, 07:33 AM   #2
tronayne
Senior Member
 
Registered: Oct 2003
Location: Northeastern Michigan, where Carhartt is a Designer Label
Distribution: Slackware 32- & 64-bit Stable
Posts: 3,541

Rep: Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065Reputation: 1065
Make yourself a little shell program, something like this
Code:
#!/bin/bash
for DB in db01 db02 db03 ...
do
     mysqldump [options] ${DB} > ${DB}.sql
done
Hope this helps some.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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



Similar Threads
Thread Thread Starter Forum Replies Last Post
C library for btree / SAM data bases yplasse Linux - Newbie 2 11-06-2010 09:47 PM
[SOLVED] Cron - mysqldump job creates an empty sql file novice32 Linux - Newbie 5 04-17-2010 12:12 PM
[Mysql] mysqldump doesn't work when restoring data Kunsheng Linux - Software 1 09-25-2009 11:24 PM
linux based data bases tmborman Linux - Newbie 2 04-24-2007 10:17 AM
mysqldump data base < filename.sql.gz ?? knockout_artist Linux - Server 7 04-12-2007 09:30 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:37 PM.

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