SQLSTATE[HY000] [1045] Access denied for user ‘symfony’@’localhost’ (using password: YES) —– docker

error

error:

In AbstractMySQLDriver.php line 112:

An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for user ‘symfony’@’localhost’ (usin
g password: YES)

In Exception.php line 18:

SQLSTATE[HY000] [1045] Access denied for user ‘symfony’@’localhost’ (using password: YES)

In PDOConnection.php line 38:

SQLSTATE[HY000] [1045] Access denied for user ‘symfony’@’localhost’ (using password: YES)

.env : DATABASE_URL=mysql://symfony:[email protected]:3306/symfony?serverVersion=5.7

docker setup: docker-compose.yml

 db:
        container_name: db
        image: 'mysql:8.0'
        command: ["--default-authentication-plugin=mysql_native_password"]
        ports:
            - "3306:3306"
        environment:
            MYSQL_ROOT_PASSWORD: root
            MYSQL_DATABASE: symfony
            MYSQL_USER: symfony
            MYSQL_PASSWORD: symfony
            DATABASE_URL: symfony.localhost
        networks:
            - db

Source: Symfony Questions

Was this helpful?

0 / 0

Leave a Reply 0

Your email address will not be published. Required fields are marked *