I’ve read every single post related to this issue but nothing seems to work for me.
I want to create a database with the following command:
$ php bin/console doctrine:database:create
The error is:
In AbstractMySQLDriver.php line 93: An exception occurred in driver: SQLSTATE[HY000]  Connection refused In PDOConnection.php line 31: SQLSTATE[HY000]  Connection refused In PDOConnection.php line 27: SQLSTATE[HY000]  Connection refused doctrine:database:create [--shard SHARD] [--connection [CONNECTION]] [--if-not-exists] [-h|--help] [-q|--quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-interaction] [-e|--env ENV] [--no-debug] [--] <command>
What I have tried so far:
- I have updated the server version
- I changed 127.0.0.1 to localhost
- I created a new user in phpmyadmin
My .env file looks like this:
# IMPORTANT: You MUST configure your server version, either here or in config/packages/doctrine.yaml DATABASE_URL=mysql://root:[email protected]:3306/myproject?serverVersion=10.4.11 ###< doctrine/doctrine-bundle ###
My doctrine.yaml file looks like this:
doctrine: dbal: driver: pdo_mysql server_version: '10.4.11' url: '%env(resolve:DATABASE_URL)%'
I appreciate any help!
Source: Symfony Questions