exception or error:
I accidentally created a database “symfony-project’ successfully, but it’s not appearing on my phpmyadmin page.I want to drop the database with
php bin/console doctrine:database:drop --force
then this message comes out
Could not drop database symfony-project
for connection named default
An exception occurred in driver: SQLSTATE[HY000] [2002] Connection refused
my database url on the .env file is
DATABASE_URL=mysql://root:@127.0.0.1:3306/symfony-project?serverVersion=5.7
How to solve:
I think you can also try the connection by attempt to create a database:
php bin/console doctrine:database:create
If you’re using Symfony 2, you need to use:
php app/console doctrine:database:create
I also see that in the string:
DATABASE_URL=mysql://root:@127.0.0.1:3306/symfony-project?serverVersion=5.7
You didn’t specify the password for root
user. Although that might be not an issue if the password is unspecified at the beginning, it’s better to re-check these credentials.