Drupal - Where does drush look for the path of the mysql socket (on MAMP)?
First of all, check which php
and php.ini
file is used by drush
:
$ drush status --full
Site URI : http://default
Database driver : mysql
Database hostname : localhost
Database username : root
Database name : drupal7
Drupal bootstrap : Successful
Drupal user :
PHP executable : /usr/local/opt/php56/bin/php
PHP configuration : /usr/local/etc/php/5.6/php.ini
Then edit its default MySQL socket name for local db connects:
pdo_mysql.default_socket=/path/to/mysql.sock
as by default it points to /tmp/mysql.sock
unless PHP was configured with different (--with-mysql-sock
).
Check by:
$ php -i | grep ^pdo_mysql.default_socket
pdo_mysql.default_socket => /tmp/mysql.sock => /tmp/mysql.sock
So probably that's why /var/mysql/mysql.sock
didn't work, as it was looking for /tmp/mysql.sock
instead.
Then the symbolic link should work as expected.
If drush
is using wrong instance of PHP, then add it into PATH
(as you did) or specify with --php=</path/to/file>
, so the right php.ini
would be loaded.
Alternatively specify unix_socket
in your settings file (as you already did).