Answer the question
In order to leave comments, you need to log in
How to fix SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution?
Good day!
I'm trying to deploy an application on yii2 basic in docker.
Error SQLSTATE[HY000] [2002] php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution.
My files:
docker-compose.yml
version: '3.5'
services:
php:
image: yiisoftware/yii2-php:7.4-apache
volumes:
- ~/.composer-docker/cache:/root/.composer/cache:delegated
- ./:/app:delegated
ports:
- '8000:80'
depends_on:
- db
db:
image: mysql
environment:
- MYSQL_ROOT_PASSWORD=verysecret
- MYSQL_DATABASE=mdb
- MYSQL_USER=yii2
- MYSQL_PASSWORD=secret
ports:
- '33061:3306'
volumes:
- ./mysql-dump:/etc/dump
return [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=mysql;dbname=mdb',
'username' => 'root',
'password' => 'verysecret',
'charset' => 'utf8mb4',
'tablePrefix' => 'dtl_',
// Schema cache options (for production environment)
//'enableSchemaCache' => true,
//'schemaCacheDuration' => 60,
//'schemaCache' => 'cache',
];
mysql:host=db;dbname=mdb
SQLSTATE[HY000] [2002] Connection refused
Forbidden
You don't have permission to access this resource.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question