Posts

mysqldump to multiple files

It is a good idea to run mysqldump by cron to regurlarly make backups of your MySQL databases. An easy way to do this is by adding the –all-databases parameter.  This way you will have a backup of all your databases – in one file though. If the amount of data and the number of databases is small this might be ok.

After the first session of restoring just one database or one table from your one-file-backup you realize that it would be nice to have the dumps split up in some convenient way. Like dumping each database to one file, one for each database.

This little shell script does the trick for you. It is really simple and has no error handling what so ever. It is released under GNU GPLv2 license. If you modifiy it or add features (like error handling or so), please do send me a copy or post it as a comment here.


#!/bin/sh
# mysqldump-multi.sh
# Copyright HelTech Communication, Stefan Helander 2010
# stefan@heltech.se, http://www.heltech.se
#
# Licensed under GNU GPLv2
#
# Dumps all MySQL databases. Each database stored in a single file.
#
# settings

DUMPDIR=/root/mysql-backup/backups
MYSQL_HOST=localhost
MYSQL_USER=root
MYSQL_PASS=YOUR-PASSWORD-HERE
MYSQL=/usr/bin/mysql
MYSQLDUMP=/usr/bin/mysqldump

# dump each db

for DB in `echo 'show databases' | $MYSQL -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS --batch -N`
do
$MYSQLDUMP -h$MYSQL_HOST -u$MYSQL_USER -p$MYSQL_PASS --quote-names --create-options --force $DB > $DUMPDIR/$DB.sql
done

TYPO3 cms installation fails in step 2

If you are installing the TYPO3 content management system (CMS), after uploading the files to your web server and setting some directory permissions, you are supposed to point your browser to your web server’s root where you just have installed TYPO3 in order to continue the installation. A screen similar to this is displayed:

TYPO3 installation step 1

Click to enlarge

Enter database username, password and server (normally “localhost”) and click continue. If the following screen (as step 2) is displayed, you are in trouble:

TYPO3 installation step 2

Click to enlarge

This screen is supposed to show you the availible databases for selection. But as you can see it ends just below the word “Database”. No error message is displayed.

The reason for this is that PHP is running in Safe mode. By configuring your webserver/PHP to run with Safe mode off the installation will work.

This situation is actually described in the TYPO3 Wiki under troubleshooting saying “This could cause the Install Tool to display an error message”. In my case it didn’t and it took some time of head scratching to figure it out.

MySQL community protests against acquisition by Oracle

The MySQL community around the world are getting worried about the possible acquistion of Sun Micosystems by Oracle. MySQL is community driven and often competes head to head with Sun Microsyftems commercial Oracle products. More than 14.000 MySQL users, developers and enthiusasts have signed a petition sent to regulators at the European Commission, Russia, China and other countries as a protest against the aqcuisition. According to eWeek it might be to late as the European Commission is expected to approve the deal within the next month.

You can sign the petition here to support the protest.