docker-symfony icon indicating copy to clipboard operation
docker-symfony copied to clipboard

Mysql remote connections

Open mytord opened this issue 9 years ago • 3 comments

Hi,

When I fill in the following at step 4.iii:

$ sf3 doctrine:database:create

I get this error:

[Doctrine\DBAL\Exception\DriverException]                                                                                                               
  An exception occured in driver: SQLSTATE[HY000] [1130] Host 'dockersymfony_php_1.dockersymfony_default' is not allowed to connect to this MySQL server

I think it happened because remote connections in mysql is disabled?

Here is my parameters.yml

# This file is auto-generated during the composer install
parameters:
    database_host: mysqldb
    database_port: null
    database_name: symfony
    database_user: root
    database_password: root

Thanks.

mytord avatar Sep 05 '16 15:09 mytord

Sorry, I've no idea :( I just try with the latest Symfony edition (3.1) and everything works fine !

Try to remove your .data folder and rebuild your container

maxpou avatar Sep 11 '16 17:09 maxpou

Most of the time the root user is a management user only, and is only allowed to connect from localhost.

Make sure you are using the right database_host. This has to be the same as the database container name.

leroy0211 avatar Dec 31 '16 14:12 leroy0211

We can make remote connection directly on "db" container IP:

docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' dockersymfony_db_1

comxd avatar Oct 23 '17 23:10 comxd