-->

Drush enable error

2019-09-02 08:45发布

问题:

when i what to enable module using drush I'm getting this error

Im using mamp pro 3 and php 5.5.10

<h1>Additional uncaught exception thrown while handling exception.</h1
<h2>Original</h2>
<p>PDOException: SQLSTATE[HY000] [2002] Socket operation on non-socket 
in drupal_is_denied() (line 1933 of /Users/edinpuzic/desktop/projekti/studiotnt
/includes/bootstrap.inc).</p>
<h2>Additional</h2>
<p>PDOException: SQLSTATE[HY000] [2002] Socket operation on non-socket 
in _registry_check_code() (line 3185 of /Users/edinpuzic/desktop/projekti/studiotnt
/includes/bootstrap.inc).</p>
<hr />Drush command terminated abnormally due to an unrecoverable error.   [error]

回答1:

I had the same issue, after poking around I've figured out that te sock files was:

/private/tmp/mysql.sock

not

/var/mysql/mysql.sock

In this case I did:

cd /var
sudo mkdir mysql 
cd mysql
sudo ln -s /private/tmp/mysql.sock mysql.sock


回答2:

The only time I've seen this is when I set hostname for the database in the Drupal config to 'localhost'. For some reason, in some situations, it looks for a local socket instead of a network socket. Look at your config and if the database host is set to localhost, try changing it to 127.0.0.1.