4

I followed exactly this setup: https://github.com/magento/magento2-samples/tree/master/sample-module-minimal and added the registration.php file, and run php bin/magento module:enable Company_Basic, but after I run php bin/magento setup:upgrade I get the following error:

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

If I change from localhost to 127.0.0.1 in env.php I get:

[Zend_Db_Adapter_Exception]                
  SQLSTATE[HY000] [2002] Connection refused

Now the website throws this error:

Please upgrade your database: Run "bin/magento setup:upgrade" from the Magento root directory. 
The following modules are outdated:
Company_Basic

I'm using mamp. I installed magento2 ok, but now it appears that mysql is connecting. Any ideas? Thanks!

Update: If I run /Applications/MAMP/Library/bin/mysqld --version I get

/Applications/MAMP/Library/bin/mysqld  Ver 5.6.25 for osx10.6 on x86_64 (MySQL Community Server (GPL))
6

The issue was that php and mamp mysql did not communicate. I was using mac php and mac mysql. But my database is in mamp mysql.

Inserting this in my bash profile:

export PATH=/Applications/MAMP/Library/bin/:/Applications/MAMP/bin/php5/bin/:/opt/local/bin:/opt/local/sbin:$PATH

export PATH=/Applications/MAMP/bin/php/php5.6.10/bin:$PATH

made sure that in command line I'm using mamp php and mamp mysql.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.