-
-
Notifications
You must be signed in to change notification settings - Fork 4.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PDOException] SQLSTATE[HY000] [2002] Connection refused #1204
Comments
Hey, I think values inside your Laravel project .env are overriding the config/database.php values (as they should be). I would replace the values inside .env instead like so: .env
|
Thanks for the response. My env-example doesn't have many of those keys in it. Therefore, neither does my .env. Here are the ones from your list that I'm not seeing: Having said that, if the DB_* keys mean (for example) MYSQL_*, then I don't see these ones in my env-example: MYSQL_CONNECTION Thanks! |
Hey, I meant the .env inside of your Laravel project, not the .env from this Laradock repository. Or you can do this, inside conf/database.php:
|
Ah. I guess I'm pretty wet behind the ears, I didn't even know such a thing existed. Thanks for the insight! What's the relationship between Thanks again! |
Aside from the file name, The entire Laravel is a framework that works great with Laradock. Laravel can be hosted with many things - a manually-installed LAMP stack, a raspberry pi, some Digital Ocean one-click droplet, or with an easily-usable (hopefully) and easily-repeatable container (Laradock). Applications made in Laravel usually require, at least, a proper database config - this will have to be setup in the Laravel This seems to be the only (existing) relation between Laravel and Laradock - the services (DB, Queue, maybe mailer, maybe reverse proxy) need to be compatible. Besides this, Laradock or Laravel can be swapped out for most other hosting stacks or web frameworks. luv u pls respond ❤️ Thanks, |
@khoaNguyen96 Sorry for the delay. Your suggestion worked. Updating laravel-project/.env with the correct database settings is working for me. Thanks! |
@AlbinoDrought thanks a lot! |
Info:
Docker version (
$ docker --version
):Docker version 17.09.0-ce, build afdb6d4
Laradock commit (
$ git rev-parse HEAD
):903c774
System info (Mac, PC, Linux):
Mac
System info disto/version:
OS X 10.12.6
Issue:
When running artisan migrate, I'm getting the following errors:
php laravel/artisan migrate
[Illuminate\Database\QueryException]
SQLSTATE[HY000] [2002] Connection refused (SQL: select * from information_schema.tables where table_schema = homestead and table_name = migrations)
[PDOException]
SQLSTATE[HY000] [2002] Connection refused
Expected behavior:
Not sure. This is my first time trying to get going with Laravel. I assume not an error.
Reproduce:
See above.
What I've tried so far
I've tried the following in conf/database.php:
The root and default users are working as expected (because I can connect using them using SQL Pro).
I can connect from the host using SQL Pro.
I can access the database using phpMyAdmin (http://localhost:8080).
The 'default' database exists.
Relevant Code:
.env:
conf/database.php
The text was updated successfully, but these errors were encountered: