This is a small PHP shell script that will extract the default connection information from local.xml
and construct the correct command-line script to do a no-locking dump of the database. You’ll need to be in the root folder of a system for this to work.
Useful if you spend a lot of time debugging different systems.
#!/usr/bin/env php
<?php
$xml = simplexml_load_file('app/etc/local.xml');
$connection = $xml->global->resources->default_setup->connection;
$username = $connection->username;
$password = $connection->password;
$db_name = $connection->dbname;
$host = $connection->host;
$cmd = 'mysqldump ' .
'-u ' . $username . ' ' .
'-p' . $password . ' ' .
'-h ' . $host . ' ' .
'--lock-tables=false ' .
'--single-transaction ' .
$db_name . ' > ' .
'/tmp/mage-db.mysql';
echo $cmd . "n";