Magento 2 setup:upgrade troubleshooting

Magento 2 setup:upgrade troubleshooting

If you’ve ever like me encounter this problem when executing magento setup:upgrade command. Try the following solution.


Get MySQL socket value

Login to your mysql from the terminal or pgadmin. Run the sql command to get socket value.

show variables like '%sock%';




In your php.ini make sure you have the correct value. For my case, “/Applications/mampstack-7.0.12-0/mysql/tmp/mysql.sock”

mysql.default_socket = "/Applications/mampstack-7.0.12-0/mysql/tmp/mysql.sock"
mysqli.default_socket = "/Applications/mampstack-7.0.12-0/mysql/tmp/mysql.sock"
pdo_mysql.default_socket = "/Applications/mampstack-7.0.12-0/mysql/tmp/mysql.sock"


Which PHP

Run command to identify which php you’re using.

which php


mingchs-MacBook-Air:magento mingch$ php -i | grep 'php.ini'
Configuration File (php.ini) Path => /etc

In my case, although I’ve mamp install, but my php command still using default php from /usr/bin/php.


Swap php

Edit profile, and add export to the first line

vi ~/.bash_profile

export PATH=/Applications/mampstack-7.0.12-0/php/bin:$PATH


Double check

Open a new terminal, and run the command again to double check you’ve using the right php.

mingchs-MacBook-Air:magento mingch$ php -i | grep 'php.ini'
Configuration File (php.ini) Path => /bitnami/mampstackDev-osx-x64/output/php/lib
Loaded Configuration File => /Applications/mampstack-7.0.12-0/php/etc/php.ini

mingchs-MacBook-Air:magento mingch$ which php



Run setup:upgrade command again, it will clear the cache and update the modules successfully.




Write a Reply or Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.