Bonjour,
J'essaie de me connecter à une bd mariaDB 10.2.8 depuis symfony4/Doctrine et je n'y arrive pas.
J'ai le message :
SQLSTATE[HY000] [2002] Aucune connexion na pu être établie car lordinateur cible la expressément refusée
Mes paramètres :
fichier .env :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| # This file is a "template" of which env vars need to be defined for your application
# Copy this file to .env file for development, create environment variables when deploying to production
# https://symfony.com/doc/current/best_practices/configuration.html#infrastructure-related-configuration
###> symfony/framework-bundle ###
APP_ENV=dev
APP_SECRET=acba46657ac17955aad1f94c9d4827f3
#TRUSTED_PROXIES=127.0.0.1,127.0.0.2
#TRUSTED_HOSTS=localhost,example.com
###< symfony/framework-bundle ###
###> doctrine/doctrine-bundle ###
# Format described at http://docs.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/configuration.html#connecting-using-a-url
# For an SQLite database, use: "sqlite:///%kernel.project_dir%/var/data.db"
# Configure your db driver and server_version in config/packages/doctrine.yaml
DATABASE_URL=mysql://db_user:db_password@127.0.0.1:3307/db_name
DATABASE_USER=root
DATABASE_PWD=''
DATABASE_NAME=dbpremiersymfo40MDB
###< doctrine/doctrine-bundle ### |
et le fichier doctrine.yaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
|
doctrine:
dbal:
# configure these for your database server
driver: 'pdo_mysql'
server_version: '10.2.8'
charset: utf8mb4
default_table_options:
charset: utf8mb4
collate: utf8mb4_unicode_ci
# With Symfony 3.3, remove the `resolve:` prefix
#url: '%env(resolve:DATABASE_URL)%'
dbname: '%env(DATABASE_NAME)%'
host: 'localhost'
user: '%env(DATABASE_USER)%'
password: '%env(DATABASE_PWD)%'
orm: |
J'ai regardé la compatibilité des drivers Mysql/mariaDB en fonction de la version, en principe c'est 0K, j'ai essayé avec un autre utilisateur que root, mais ça ne marche pas.
A noter que la connexion avec les mêmes paramètres passe dans mysqlworkbench.
Merci pour votre aide.
Cordialement
Partager