![]() In the mysql section add the next line at the end: 'unix_socket' => '/tmp/mysql.sock' In your laravel project folder, look for the database.php file there is where you configure the DB connection parameters. Keep the value of the last row: /tmp/mysql.sock | performance_schema_max_socket_instances | 322 | | performance_schema_max_socket_classes | 10 | ![]() Then once you get the mysql promt type the next command: mysql> show variables like '%sock%' It will ask you for the related password. Open a terminal and connect to the mysql with: mysql -u root -p To get this problem fixed, I follow the next steps: The reason I found is just because PHP and MySQL can't get connected themselves. After that when I was working with models and DB I got the error: Then I just configured the mCrypt library to get started. I have enabled the Apache Server and PHP that already comes with the OS. I got the same problem and I'm running Mac OS X 10.10 Yosemite. However "127.0.0.1" uses TCP (Transmission Control Protocol), which essentially means it runs through the "local internet" on your computer being much more reliable than the UNIX socket in this case. The issue that arose here is that "localhost" uses a UNIX socket and can not find the database in the standard directory. It seems as though they use different connection types as explained in this post Some people have asked as to why this fix works so I have done a little bit of research into the topic. Not sure why "localhost" doesn't work by default but I found this answer in a similar question solved in a symfony2 post. I solved the problem by changing the "host" in the /app/config/database.php file from "localhost" to "127.0.0.1". ![]() ![]() None of the above solutions worked for me. Laravel 4: Change "host" in the app/config/database.php file from "localhost" to "127.0.0.1" ![]()
0 Comments
Leave a Reply. |