Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error creating database with doctrine orm symfony

When I try to create a database with the command

$ php bin/console doctrine:database:create

I get those errors


2019-04-02T12:45:01+02:00 [error] Error thrown while running command "doctrine:d
atabase:create". Message: "An exception occurred in driver: SQLSTATE[HY000] [104
5] Access denied for user 'root'@'localhost' (using password: YES)"

In AbstractMySQLDriver.php line 93:

  An exception occurred in driver: SQLSTATE[HY000] [1045] Access denied for u
  ser 'root'@'localhost' (using password: YES)


In PDOConnection.php line 31:

  SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas
  sword: YES)


In PDOConnection.php line 27:

  SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using pas
  sword: YES)

I uninstalled xmapp, composer, symbony and installed them again.

  • PHP version 7.3.3
  • Composer version 1.8.4
  • Symfony CLI version v4.3.3

Followed those steps to install orm doctrine found here https://symfony.com/doc/current/doctrine.html

 composer require symfony/orm-pack
 composer require --dev symfony/maker-bundle

Modified .env file

DATABASE_URL=mysql://root:[email protected]:3306/test

Then, executing

php bin/console doctrine:database:create

And then, the error comes.

like image 365
Pekka R Avatar asked Jun 17 '26 19:06

Pekka R


1 Answers

The .env file was looking like this:

DATABASE_URL=mysql://root:[email protected]:3306/articles

I just removed the password, and the problem was solved:

DATABASE_URL=mysql://[email protected]:3306/articles

Now the database is created.

like image 127
Pekka R Avatar answered Jun 21 '26 09:06

Pekka R



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!