php artisan migrate, got the following error:
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
NB: php -v is 5.5 and mysql -v is 5.5 from the terminal Here is part of my config/database.php
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'essays',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),
I tried replacing localhost with 127.0.0.1 with no avail. Kindly help..
Edit: I added these three lines in my php.ini
mysql.default_socket = /var/run/mysqld/mysqld.sock
mysqli.default_socket = /var/run/mysqld/mysqld.sock
pdo_mysql.default_socket = /var/run/mysqld/mysqld.sock
I also added this symlink:
sudo mkdir /var/mysql
cd /var/mysql && sudo ln -s /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock
But that didnt solve. I also pulled a fresh new laravel project from git and ran into the same error after composer install
then php artisan migrate
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
The mac version is 10.7.4
If you are using MAMP be sure to add the unix_socket
key with a value of the path that the mysql.sock
resides in MAMP.
'mysql' => array(
'driver' => 'mysql',
'host' => 'localhost',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'database' => 'database',
'username' => 'root',
'password' => 'root',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
),