Avoid a possible MySQL5 error on first run

Aug 10, '05 09:48:00AM

Contributed by: CaptDeuce

Downloading and installing MySQL 5 is a fairly straight-forward process, especially when using the official package from the MySQL folks, as they use a Mac OS X .pkg installer. The last step for starting the server requires entering these three Unix commands in Terminal.app:

 $ cd /usr/local/mysql
 $ sudo chown -R mysql data/
 $ sudo ./bin/mysqld_safe &
Instead of a happy MySQL server, I consistently received the following error message:
[ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.host' doesn't exist
After much Googling and gnashing of teeth, I stumbled upon a fix in the section titled 'Database Re-Initialization' on Marc Liyanage's entropy.ch site. Before running the mysqld_safe command, enter this:
 $ sudo hostname 127.0.0.1
and Bob's your uncle. I exchanged a note with Marc, who told me that it's a DNS problem. I presume my problem is that I installed MySQL on my Mac on my home network without a DNS, and the 10.4 default URL for my machine is macname.local. Apparently the mysqld_safe command has MySQL connect to itself during launch -- and nobody was home. The Rendez... er, Bonjour .local URL nomenclature strikes again?

Comments (1)


Mac OS X Hints
http://hints.macworld.com/article.php?story=20050805120857219