MySQL Upgrade Gotcha

I was trialling a MySQL database upgrade today (from 5.0 to 5.1) and hit a nasty little gotcha that I feel warrants a mention (mostly to myself). In its simplest form, the upgrade process is very straightforward and involves simply loading data dumped from MySQL 5.0 into a 5.1 database (using a regular mysql command), followed by a once-off execution of the mysql_upgrade command (to bring the various tables and grants up to date):

$ mysql -u root -p testdb < dumped50.sql
$ mysql_upgrade -u root -p testdb

However, when I tried the latter command, I received this error:

Looking for 'mysql' in: mysql
FATAL ERROR: Can't find 'mysql'

I did fine a simple solution here which was to first change to the directory containing the mysql_upgrade program itself and execute it from there:

$ cd /opt/coolstack/mysql/bin
$ ./mysql_upgrade -u root -p testdb

As I said, its a simple solution and I do tend to follow this general rule most of the time but nevertheless, the error generated when you don’t do this is far for informative.

Forgotten Unix Tricks?

I’ve been using differing flavours of Unix for almost 20 years now and have a fine appreciation for the power of the humble command-line (often from a DOS perspective too). It’s no wonder then, that I was drawn to this excellent post entitled, Stupid Unix Tricks?.

It’s a full-on geek fest of clever *nix tips and tricks and is anything but stupid (as the poorly named article suggests). If you have even the remotest passing interesting in the Unix operating system, be sure to check it out – there’s something in there for everyone.

Source: SlashDot