MySQL export to CSV

MySQL allows you to export a query directly in to a CSV file that can be opened by Microsoft Excel.

This is the basic syntax:

select fields from table into outfile '/path/to/file_name.csv' fields terminated by ',' optionally enclosed by '"' lines terminated by '\n';

The export file that is created “file_name.csv” must not already exist, the MySQL user must have write permissions to the directory the file will be created in, and the FILE permission within MySQL.

See the MySQL manual: SELECT Syntax

Viewing Flickr as a solar system

Flickr is possibly the largest collection of public photos on the planet.  Flickr has an API which allows anyone with some programming skills to write their own programs and websites, etc using their images and data.

Yesterday I came across the http://taggalaxy.de/ which allows you to view Flickr as a solar system.  You search for an image tag and this becomes the centre of your solar system, and the most popular associated tags are the surrounding planets.

It’s another different way of exploring this vast collection!

Creating a MySQL unicode UTF-8 database

Here’s the syntax for creating a UTF-8 database in MySQL as I can never remember it!

CREATE DATABASE `databasename` /*!40100 DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci */;

New domain and blog!

This is the first entry on my new blog! This site is hosted by Web Hosting Buzz. So far I am impressed with the ease of configuration and installation. This WordPress installation was installed by a few simple clicks using their administration tools, saving me from downloading, installing and configuring it all myself.

All I need now is a new theme/design and some worthwhile content!