On 25-Jun-2003 Rob wrote:
> Hi all,
>
> Is there any way to do a mysql dump in which each table is dumped into a
> separate file. I know I can use the --tables option to specify a table,
> but this means I have to type out each table name (and there are a lot
> of them). Is there any way to get mysql to automatically iterate
> through all the table names and dump each table to a separate file. The
> reason for this is that the db is BIG and we don't want to have to lug
> 200+mb files around. Plus mysql seems to have a real issue with dumping
> large dbs into one file. We've tried about 5 - 10 times and we keep
> getting corrupted data in the file.
>
---
#!/bin/sh
#
DBS="gl ar ap inv"
for K in $DBS
do
TBLS=`mysql -N -e "show tables" $K`
for I in $TBLS
do
mysqldump -e -q --add-drop-table $K $I > $K.$I.sql
rm -rf $K.$I.sql.gz
gzip $K.$I.sql
done
done
---
Regards
--
Don Read [EMAIL PROTECTED]
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.
(53kr33t w0rdz: sql table query)
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]