Feature #49701

Add tasks to deal with mysql dumps

Added by Felix Oertel over 8 years ago. Updated almost 6 years ago.

Won't have this time
Target version:
Start date:
Due date:
% Done:


Estimated time:



this allows you to
  • dump database into a file
  • play dumped file into database

Of course working in a two-node-constellation, so you can simply pipe sql from your live-server to your preview-server for example. I will add documentation, as soon as it is given, you want to integrate that feature.

The target of an operation is the node you are currently deploying to (backup would be one exception, as you would backup the current node to a target place.). For now we want to stick to dump database -> write database, so you have to set up a second node, acting as the source. You do this just like a normal node:

$sqlSourceNode = new \TYPO3\Surf\Domain\Model\Node('sqlSource');
$sqlSourceNode->setOption('username', 'foertel');

You can add pathes to the mysqldump or gzip binary, if you have to.

$sqlSourceNode->setOption('mysqldumpBinary', '/usr/bin/mysqldump');
$sqlSourceNode->setOption('gzipBinary', '/bin/gzip');

Next up you have to configure the task itself:

$node->setOption('typo3.surf:mysql:dump', array(
'node' => $sqlSourceNode,
'database' => 'foertelcom',
'username' => 'admin',
'password' => '',
'ignoreTables' => array('tx_extbase_cache_object', 'tx_extbase_cache_object_tags', 'tx_extbase_cache_reflection', 'tx_extbase_cache_reflection_tags'),
'hostname' => 'localhost,
'additionalParameters' => '--single-transaction --quick --lock-tables=false',

As you can see, you could just use your node for the 'node'-directive, if that's what you want. ;)

Just add typo3.surf:mysql:dump as a task to your deployment and it will dump your database to a file in /tmp/surf_$releaseIdentifier.sql.gz

Now you could move that file to a backup folder (there is no task for that right now, I have one and will publish it soon, node-based rsync included ;) )

All you can do right now is putting that dump back into a(nother) database. The typo3.surf:mysql:integrate will always use the current node to put the dump in ... makes sense. So just add the task configuration:

$node->setOption('typo3.surf:mysql:integrate', array(
'database' => 'foertelcom',
'username' => 'admin',
'password' => '',

and add the task to your deployment.

To clean up the dump after you, just add typo3.surf:mysql:removeTempFile task and you are good to go!


Updated by Gerrit Code Review over 8 years ago

Patch set 1 for branch master has been pushed to the review server.
It is available at https://review.typo3.org/21935


Updated by Helmut Hummel almost 6 years ago

  • Status changed from New to Rejected
  • Priority changed from Should have to Won't have this time

Development of TYPO3 Surf now moved to Github. If you think this is still relevant, please open a bug report or feature request here:


Also available in: Atom PDF