LoginSignup
0
0

More than 1 year has passed since last update.

【EC-CUBE4系】MAMPで新規カラム追加しようとしたところ、エラー発生(An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory)

Posted at

下記リンクを参考に、EC-CUBE4.1系でテーブルのカラムを拡張しようとした。
https://doc4.ec-cube.net/customize_entity

▼エラー

エラーが発生したコマンド
$ bin/console doctrine:schema:update --dump-sql

エラー内容
An exception occurred in driver: SQLSTATE[HY000] [2002] No such file or directory

データベースのテーブルは、あるのに。
SQLは、起動しているのに。
なぜだ。。。

▼解決策

PHPのパスを確認してみたところ、ローカルのパスが通っていた。
MAMPを使う場合は、MAMPで使用しているPHPのパスを通しておく必要があった。

$ where php
→実行結果は、ローカルで使用しているPHPのパスのみ存在
 /opt/homebrew/bin/php

$ vi ~/.zshrc
下記をviにて記述
export PATH=/Applications/MAMP/bin/php/php7.4.21/bin:$PATH

$ source ~/.zshrc

$ where php
→実行結果は、/Applications/MAMP/bin/php/php7.4.21/bin/php

上記を確認して、ターミナルを再起動。
下記を実行したら、テーブルにカラムを新規作成できました。
$ bin/console doctrine:schema:update --dump-sql
$ bin/console doctrine:schema:update --dump-sql --force

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0