I was developing my application originally in Laravel 4.2 but have since decided to move it to the 5.0 version so that it covers a lot more changes and strengths that 5.0 has over 4.2.
I am trying to run my migratiosn however I am getting the error:
[PDOException]
SQLSTATE[HY000] [2002] No such file or directory
I looked into this and noticed how it is because I'm running MAMP for my server instead of vagrant and homestead. I'm not knocking the uses of those two but I at this point feel more comfortable with MAMP until it fails me. The reason I know its MAMP is because of needing to declare the unix socket value to be used.
Now on my 4.2 version of my application I have the following:
'mysql' => array(
'driver' => 'mysql',
'unix_socket' => '/Applications/MAMP/tmp/mysql/mysql.sock',
'host' => getenv('DB_HOST'),
...
),
With my Laravel 5.0 version I am making use of the .env file for my Environment variables and not sure how I need to do this so that it knows to use the unix socket value.
Cans someone clue me into how I should adopt this into the new version or a better way to add it into the settings so that I don't have to do that?
mysql.sock
on your computer at the specified place. Computers don't make mistakes on that. If it says there is no file there, it is because there is no file there. If you installed your MAMP in a non-default location, you may solve your problem by updating your config with the good path to themysql.sock
file, but MAMP themselves do not recommend installing their software somewhere else, because many problems such as this one will arise. – Félix Gagnon-Grenier Mar 27 '15 at 17:12No such file or directory
is not making an error, leaving us two choices, either the file is not where you write it is, or the function appends something to the path, making it wrong. But please, please, please, PLEASE stop believing the computer is making a mistake. The file it is looking for is not where it is, period. There's nothing else to it. Find the exact path the function is trying to include, and post it here. – Félix Gagnon-Grenier Mar 27 '15 at 19:24