Skip to content
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

Database Exception, SQLSTATE[HY000] [2002] Connection refused #17

Closed
NoorBakeer opened this issue Jul 28, 2018 · 5 comments
Closed

Database Exception, SQLSTATE[HY000] [2002] Connection refused #17

NoorBakeer opened this issue Jul 28, 2018 · 5 comments

Comments

@NoorBakeer
Copy link

NoorBakeer commented Jul 28, 2018

PDOException: SQLSTATE[HY000] [2002] Connection refused in /var/www/vendor/yiisoft/yii2/db/Connection.php:687

'db' => [ 'class' => 'yii\db\Connection', 'dsn' => self::env('DB_DSN', 'mysql:host=127.0.0.1:3306;dbname=sarmad'), 'username' => self::env('DB_USER', 'root'), 'password' => self::env('DB_PASSWORD', ''), 'charset' => 'utf8', 'tablePrefix' => '', ],

@mikehaertl
Copy link
Collaborator

Sorry, but for a bug report this is really too little information. So I will close this as it very much indicates a permission problem with you mysql container. That's not at all related to our app template here.

@giuliogatto
Copy link

I had the same error of Connection Refused, it was not a Permission problem but a problem with MySql version: for some reasons MySql 8.0 refused to connect, when changing to mysql:5.7 (in docker-compose.yml on main folder) everything just worked fine

@mikehaertl
Copy link
Collaborator

Hmm, is there anything to fix here? That's a general Yii / Mysql 8 issue - nothing specific to this image.

@giuliogatto
Copy link

Well, maybe momentarily force MySql to version 5.7 in docker-compose-example.yml like this:
image: mysql:5.7
Anyways I just wrote the comment so that anybody finding the same error will try a different version of MySql because it looks like latest is not working correctly in this case ;)

mikehaertl added a commit that referenced this issue Feb 12, 2019
@mikehaertl
Copy link
Collaborator

Makes sens. I've added a mysql:5 constraint.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants