Oliver Nassar

MySQL Error: Invalid Default Character Set

September 26, 2012

In rebuilding my EC2 instance (having decided to upgrade from Ubuntu 11.10/Oneiric Ocelot to Ubuntu 12.04 LTS/Precise Pangolin), I ran into an issue in my standard-build-script.

My build script does a lot of things, one of them being to install MySQL. After it ran, I tried to connect, and ran into this error:

ERROR 2002 (HY000): Can't connect to local MySQL server

I went through my build script carefully, and discovered the culprit.
In my 11.10 instance, when I run mysql --version command I get:

mysql Ver 14.14 Distrib 5.1.54, for debian-linux-gnu (x86_64) using readline 6.2

In my 12.04, I get:

mysql Ver 14.14 Distrib 5.5.24, for debian-linux-gnu (x86_64) using readline 6.2

It seems they are running different distributions.

My build script made some modifications to my /etc/mysql/my.cnf file, including adding the following character set rule to the [mysqld] block:
default-character-set=utf8

This results in MySQL failing to start up, providing the error:

start: Job failed to start

I simply had to move that rule to the [mysql] block, and all is well :)