When you install Drupal 7 in Mac OS X Snow Leopard, somehow you get problem about PDO MySQL like this error ?
Warning: PDO::__construct():  No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) in DatabaseConnection->__construct() (line 289 of /Users/drupal7/includes/database/database.inc).
In order for Drupal to work, and to continue with the installation process, you must resolve all issues reported below. For more help with configuring your database server, see the installation handbook. If you are unsure what any of this means you should probably contact your hosting provider.
Failed to connect to your database server. The server reports the following message: SQLSTATE[HY000]  No such file or directory.
Is the database server running?
Does the database exist, and have you entered the correct database name?
Have you entered the correct username and password?
Have you entered the correct database hostname?
This happen because you have invalid path for PDO.mysql sock in /etc/php.ini. Now, edit your /etc/php.ini :
; Default socket name for local MySQL connects. If empty, uses the built-in
; MySQL defaults.
Then restart your Apache now.
To assure if you give the right path, read your MySQL default socket in /etc/my.cnf. Now, you can install Drupal 7 in your Mac OS X Snow Leopard. Voilaa!!
In case, you still found error, then install PDO_MYSQL from http://pecl.php.net/package/PDO_MYSQL
wget -c http://pecl.php.net/get/PDO_MYSQL-1.0.2.tgz
tar -xvvf PDO_MYSQL-1.0.2.tar
LDFLAGS='-arch x86_64' ./configure --with-pdo-mysql=shared,/usr/local/mysql
sudo make install
After install, you will receive where path this PDO module installed, in my Mac, like this :
Macbook-Pro:PDO_MYSQL-1.0.2 yodi$ sudo make install
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20090626/
Then edit your /etc/php.ini and add this line inside :
Then restart your Apache!
From Ben :
If you are trying to compile with the above directions and you have a 32-bit version of MySQL you might receive the error below as I did.
configure: error: mysql_query missing!?
To resolve the issue I simply compiled by changing x86_64 to i386.