Link to home
Start Free TrialLog in
Avatar of xpandit
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.


Avatar of MMDeveloper
MMDeveloper
Flag of United States of America image

mysqldump -r EXPORTFILE.sql DATABASENAME

if you need to provide login credentials for mysql

mysqldump -u USERNAME -p -r export.sql DataBaseName
Avatar of xpandit
xpandit

ASKER

Does that dump each table as an individual file? eg DATABASENAME_TABLENAME.sql ?
ASKER CERTIFIED SOLUTION
Avatar of theGhost_k8
theGhost_k8
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Missed a DOT at line 40:
            print "mysqldump -u$username -p$password $databasez $tablez > $tablez."."sql" . "\n";

1 more typo :--    sh Dumps.sh
;)