Basic Usage:

mysqldump -u root -pSECRET –quote-names –databases  mydatabasename > mydatabasename.sql

If find it best to include the –databases switch as this will add the ‘DROP DATABASE’ and ‘CREATE DATABASE’ statements when restoring – proceed carefully.
Quote Names:

Quoting the file names can be an insurance against users who may have created field names with spaces in them 🙁

mysqldump -u root -pSECRET –quote-names –databases mydatabasename > mydatabasename.sql

Dump All Databases:

mysqldump -u root -pSECRET –quote-names –all-databases > fullbackup.sql

Zip the ouput file:

nice mysqldump -u root -pSECRET –quote-names –databases dbname1 dbname2 dbname3 | nice gzip -9 > mybackup.sql.gz


mysqldump -u root -p  –compatible=mysql40 –databases databasename > mybackup.sql

Other compatibility options include:

ansi, mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb, no_key_options, no_table_options, no_field_options

Dump structure-only:

mysqldump -u root -p –no-data –databases dbname1 dbname2 > mybackup.sql

Backup to another MySQL Server

mysqldump -u root -p –host=host1 mydatabase | mysql -u root -p –host=host2 -C newdatabase

The C option specifies to use compression. Note databases must exist already on the target server.


mysql -u root -p dbname < mybackup.sql

Character Sets / Collation Problems
Convert the database exporting first like this:

mysqldump -u username -p –default-character-set=latin1 –compatible=mysql40 dbname > dump.sql

Then import overwriting the current database (another backup would be wise):

mysql -u username -p –default-character-set=utf8 dbname < dump.sql

MySQL Adding Users
In case you need to access the MySQL database remotely (as in the above example to backup to another server):

mysql -u root -p
grant all privileges on *.* to ‘jonny’@’%’ identified by ‘thepassword’;
flush privileges;

Fighting Spam in QUB Exchange

If you are suffering problems with Junk Email please check or do the following:

Cached Exchange Mode

Check that you are using Cached Exchange Mode:

  • In Outlook 2007 choose Tools > Account Settings …
  • In the Account Settings dialog select the ‘Microsoft Exchange’ account then click the ‘Change…’ button
  • In the ‘Change E-mail Account’ dialog ensure the option for ‘Use Cached Exchange Mode’ is ticked

Exchange Junk Email
Ensure that your mailbox account on Exchange is set to filter Junk Email:

  • Log in to OWA using MS Internet Explorer (not Firefox)
  • Click on ‘Options’ at the top right of the page
  • Click on ‘Junk E-mail’ on the left menu
  • Ensure that ‘Automatically filter junk e-mail’ is selected

Example robots.txt

Not all crawlers obey all of these rules but as a reference point. The crawl delay is the number of seconds between requests and the newer request-rate is set here to not more than 1 every 5 seconds. The crawlers are also asked to visit during the night.

User-agent: *
Disallow: /media/
Crawl-delay: 10
Request-rate: 1/5
Visit-time: 2100-0545