简体   繁体   中英

Laravel 4.2 and Mysql Connection

I have Xamp(which runs mysql) which i always use to run every laravel project i do (laravel 5+) and works fine.

Now, i have a project built with laravel 4.2 which i connected to the Xamp i use. I have been able to migrate and seed the tables. But now, when i try to load the page localhost:8000 , it get this error

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

After reading for solution online, i realized the project is not connecting to mysql on the Xampp for some reasons which i don't know.

I have downloaded mysql and when i run the new mysql downloaded, and run localhost:8000 , it recognizes the new mysql.

How can i solve this issue by making the laravel 4.2 project rely on the mysql on my Xampp?

PS: sorry for my english

Can you check if you have same DB configuration in both the files in case you're using an environment file.

'host'      => 'localhost',
'database'  => 'yourlaraveldb',
'username'  => 'yourdbuser',
'password'  => 'yourdbpass',

> app/config/database.php
> .env

With below setup in my Windows 10, it's working fine though.

PHP 5.6.30
XAMPP Version 5.6.30
XAMPP Control Panel Version 3.2.2
Laravel 4.2

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM