mac os 10.6.8 (snowleopard)
php 5.3.8
mysql Ver 14.14 Distrib 5.5.21, for osx10.6 (i386) using readline 5.1
(mysql user and password established for gallery@localhost, @127.0.0.1 and others, but no database or tables created)
attempt to install (from cli) failed with (default) host localhost
% php index.php -u gallery -p gallery
Oops! Something went wrong during the installation:
==> Unable to connect to the database.
No such file or directory
For help ...
** INSTALLATION FAILED **
BUT using numeric host 127.0.0.1 succeeds
% php index.php -u gallery -p gallery -h 127.0.0.1
. . . (some few seconds pass here)
Your Gallery has been successfully installed!
We've created an account for you to use:
username: admin
password: <######>
As far as I can tell, the failure was in being unable to evaluate the name "localhost" and turn it into an address. The connect attempt fails.