xpandit
asked on
Dynamic MySQL Dump
I need a script that would do a dynamic dump of a MySQL database on Ubuntu linux. Please could someone assist with the following pseudo code:
1. Get all table names from database.
2. Loop through each of the table names dumping that tables structure and data to an individual file specific to that table.
1. Get all table names from database.
2. Loop through each of the table names dumping that tables structure and data to an individual file specific to that table.
ASKER
Does that dump each table as an individual file? eg DATABASENAME_TABLENAME.sql ?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Missed a DOT at line 40:
print "mysqldump -u$username -p$password $databasez $tablez > $tablez."."sql" . "\n";
print "mysqldump -u$username -p$password $databasez $tablez > $tablez."."sql" . "\n";
1 more typo :-- sh Dumps.sh
;)
;)
if you need to provide login credentials for mysql
mysqldump -u USERNAME -p -r export.sql DataBaseName