1

So, I have recently installed Mysql Server in my Macbook (Mac OS 10.11) and I also installed Mysql Workbench and it works great!

The problem comes when I want to migrate form a Laravel Project using Php Artisan, every time I run the php artisan migrate command it return the following error

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

I also noticed I have to mysql installations i the following paths:

/usr/local/mysql
/usr/local/mysql-5.7.13-osx10.11-x86_64/ (this is the one I am using)

I placed in the .bash_profile a PATH to the new one (5.7.13) like this:

export PATH=${PATH}:/usr/local/mysql-5.7.13-osx10.11-x86_64/bin/

Do you guys know how can I fix this? Thank you for any help!

andres.gtz
  • 624
  • 12
  • 22

1 Answers1

0

Path to the binary doesn't matter, in this case it's looking for a MySQL socket file.

  1. Find your socket file (find / -name mysql.sock)
  2. Ensure this path is set in my.cnf used by your PHP (you can run php -i |grep pdo_mysql.default_socket to see the default path)
  3. As a workaround, you could set a symbolic link from 1 to 2 (eg. ln -s /usr/local/mysql/var/mysql.sock /tmp/mysql.sock) but ideally you want to set a correct path for PDO (or whatever MySQL extension you are using for PHP)
Denis Mysenko
  • 6,366
  • 1
  • 24
  • 33