I'm trying to implement this pre-cooked package of NGINX, PHP-FPM, MySQL, E-L-K.

Everything is working fine but the connection with the database. It throws a ConnectionException.

I'm not really sure if the program should try to access instead of, and where does this configuration comes from.

The IPs of my containers are:

/dockersymfony_elk_1 -

/dockersymfony_nginx_1 -

/dockersymfony_php_1 -

/dockersymfony_db_1 -

The error:

An exception occured in driver: SQLSTATE[HY000] [1045] Access denied for user 'root'@'' (using password: YES)

What could be happenning? Is there a way to check a mysql connection manually?

  • 2
    The error msg appears to suggest a connection from (or at least using the identity of that system's root user) not to it and it looks more of an access permission (or misconfigured user) issue. – Dan Cornilescu Aug 3 '17 at 16:25
  • Please add the docker command that was used to start the container – 030 Aug 3 '17 at 16:40
  • Yes. What are you connecting with? Code? Are you able to use the mysql command to connect using the appropriate switches? Are you specifying the database when you connect, or just connecting to mysql? I'll edit my answer below to address your specifics if you can provide this information. – James Shewey Aug 3 '17 at 17:35

Since the response is Access denied for user so the port and the ip address is correct.

I guess the only issue as @James said will be in the permission, you have to allow root access to mysql from elk and php containers, you can do it in easy way but it's not secure:

  • %: mean match all

or you can specify who has the access per domain name or ip:


PS: don't forget to change the password to match you root password

| improve this answer | |
  • 1
    IMHO Access denied for user doesn't necessarily mean the port and the ip address are correct - it could be the wrong server with the error message simply indicating the credentials intended for the right server aren't a match for the actual server. But I admit, it's not a very likely case :) – Dan Cornilescu Aug 9 '17 at 19:25
  • @DanCornilescu You are right, Actually what I meant to say that there are no firewall blocking the access to that ip and that port, and there is a service listening on that ip:port – Wissam Roujoulah Aug 10 '17 at 5:09

First, confirm that the container is actually listening for connections and has properly bound to the interface. If not, you probably need to fix the bind-address= and/or port= directives in your my.cnf.

Otherwise, you probably have an issue with your GRANTs. Check that the IP/subnet is correctly authorized in the mysql.user table with the command

select user,host from mysql.user

If the host field is incorrect, you will need to fix it using a UPDATE

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.