-1

I am trying to create my test database within Symfony 4.4 project using:

php bin/console doctrine:database:create --env=test

But keep getting an error:

An exception occurred while executing a query: SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'myproject_user'@'%' to database 'myproject_test'

In my .env.test url is defined like:

DATABASE_URL=mysql://myproject_user:password_1@database:3306/myproject_test

What is causing the problem? I can assume it's @ character, but this way is my database url defined in .env file also. I can not figure out what could be the problem?

misafe
  • 37
  • 5

1 Answers1

0

Your DATABASE_URL is correct. The problem come from your user which exist, but has no acces right to create table in database.

You can see some existing post about this problem:

SQLSTATE[42000]: Syntax error or access violation: 1044 Access denied for user 'ion'@'localhost' to database 'a901ce392dad4b90b1c6e175b07196a9'

"SQLSTATE[42000] [1044] Access denied for user 'team'@'localhost' to database 'my database''

ERROR 1044 (42000): Access denied for user ''@'localhost' to database 'db'

Florent Cardot
  • 1,400
  • 1
  • 10
  • 19