php - Symfony/Doctrine timeout expired sqlstate
问题描述
Hey guys so im trying to connect to my databse that's already created in postgresql (I'm using PGAdmin4 for the user interface of postgresql).
I'm on Symfony CLI version v4.16.3
get three different Timeout.
In details i have a .env
file that take the my database url :
DATABASE_URL=postgresql://root:password@127.0.0.1:35583/nd2d?serverVersion=12.3
My doctrice.yaml
is set up like this :
doctrine:
dbal:
url: '%env(resolve:DATABASE_URL)%'
orm:
auto_generate_proxy_classes: true
naming_strategy: doctrine.orm.naming_strategy.underscore_number_aware
auto_mapping: true
mappings:
App:
is_bundle: false
type: annotation
dir: '%kernel.project_dir%/src/Entity'
prefix: 'App\Entity'
alias: App
I had issue but found a way to fix they were related to pdo drivers for postgresql.
but after i launch the command bin/console make:migration
i get those 3 errors:
In AbstractPostgreSQLDriver.php line 73:
An exception occurred in driver: SQLSTATE[08006] [7] timeout expired
In PDOConnection.php line 31:
SQLSTATE[08006] [7] timeout expired
In PDOConnection.php line 27:
SQLSTATE[08006] [7] timeout expired
I avoided working on heavyn program with PHP or any framework related to it but this time i don't have a choice, soo much configuration i cant take it anymore, been on this for soo many hours now. What am i missing. Thank you :)
解决方案
Error came from listening on the wrong port, i was listening to the port 35583
, which is the port that PgAdmin is showed on the web browse.
DATABASE_URL=postgresql://root:password@127.0.0.1:35583/nd2d?serverVersion=12.3
The port i should have been listening to is the default postgresql port of 5432
推荐阅读
- node.js - 找不到角色的实体元数据
- python - 用 selenium python 抓取 youtube
- pandas - 如何创建多个空 pd.DataFrame,它们的名称类似于 List 中的值
- python - django模型方法返回带有注释的查询集
- angular - 替换选项卡路由角离子中的组件
- api - 将日期转换为纪元添加一个点?
- python - 如何使用 CMD 提示符在 IDLE 中运行 python 脚本
- python-3.x - 如何从 CSV 文件将数据插入 Influxdb
- html - 使容器内的 div 元素具有响应性
- php - 防止用户在表中具有相同的计数