drupal-console icon indicating copy to clipboard operation
drupal-console copied to clipboard

[PDOException] SQLSTATE[HY000] [2002] No such file or directory

Open bunset opened this issue 11 years ago • 10 comments

Drupal 8 beta 14 installation in Mac OS X 10.7.5

Steps to reproduce: Inside root drupal directory I execute the console, in my case I have called it "drupal" and I receive this message:

[PDOException]
SQLSTATE[HY000] [2002] No such file or directory

What can I do?

bunset avatar Sep 09 '15 00:09 bunset

@bunset: We got that issue reported on the gitter channel by @Eyal-Shalev:

I encountered the following error when trying to use drupal console with my aquia dev desktop installation of drupal8:

[PDOException]
SQLSTATE[HY000] [2002] Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

I solved it by creating the following symlink:

ln -s /Applications/DevDesktop/mysql/data/mysql.sock /tmp/mysql.sock

May you confirm if this fix your issue too?

jmolivas avatar Sep 09 '15 00:09 jmolivas

Hi The description of my issue is different. It doesn't work for me. But I have good news. I have fixed it by changing server=localhost for server=127.0.0.1 in my setting.php file.

Thanks anyway and kind regards.

bunset avatar Sep 09 '15 01:09 bunset

We have that fix already on the gitbook http://hechoendrupal.gitbooks.io/drupal-console/content/drupal_console_faq/installation-problems.html

jmolivas avatar Sep 09 '15 01:09 jmolivas

@bunset closing this since fixed.

jmolivas avatar Sep 09 '15 04:09 jmolivas

settings.php: $databases['default']['default'] = array ( ... 'host' => '127.0.0.1', ... );

ranierimachado avatar Feb 04 '16 17:02 ranierimachado

@jmolivas what if my drupal does not have access to the database? These fixes assumes that DB is up and running. But is it possible to run drupal console without access to the database? For example to generate modules or entities?

SiliconMind avatar May 10 '16 15:05 SiliconMind

Some drupal console commands require an active installation of a drupal site and some don't.

I think that module generation requires a drupal installation.

On Tue, May 10, 2016, 18:34 SiliconMind [email protected] wrote:

@jmolivas https://github.com/jmolivas what if my drupal does not have access to the database? These fixes assumes that DB is up and running. But is it possible to run drupal console without access to the database? For example to generate modules or entities?

— You are receiving this because you were mentioned. Reply to this email directly or view it on GitHub https://github.com/hechoendrupal/DrupalConsole/issues/845#issuecomment-218196051

Regards, Eyal Shalev

Eyal-Shalev avatar May 11 '16 12:05 Eyal-Shalev

I'm using Vagant. I realize that some commands will need to be run from within Vagrant in order to work, but I thought "drupal check" would at least partially work from within the root drupal directory. Any drupal command fails with [PDOException} from within a Vagrant drupal site.] I'm setting up the remote access configuration which I expect to work, but I thought I'd comment here because I doubt I'm the only one who will run into this.

tschet avatar May 17 '16 20:05 tschet

any way to get drupal console to work more like drush in regards that it can allow for a --uri parameter for remote databases?

cmcintosh avatar Jul 11 '16 04:07 cmcintosh

I confirm, 127.0.0.1 is better understood then localhost for host value in settings.php. Thank you!

AndrianD avatar May 12 '18 18:05 AndrianD