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

Problem with the mysql database while starting Mautic with docker-compose.yml

Open UtenteWeb opened this issue 5 years ago • 8 comments

Hello everyone, I am writing to tell you about a problem I had while starting Mautic with docker-compose. After creating the file docker-compose.yml, after pasting the example code in the page dedicated to Mautic's image on the Docker Hub, I executed the command docker-compose up, and the output I received was the following:

Recreating progettodockermautic_mariadb_1 ... done Recreating progettodockermautic_mautic_1 ... done Attaching to progettodockermautic_mariadb_1, progettodockermautic_mautic_1 mautic_1 | warning: both MAUTIC_DB_HOST and MYSQL_PORT_3306_TCP found mautic_1 | Connecting to MAUTIC_DB_HOST (127.0.0.1) mautic_1 | instead of the linked mysql container mariadb_1 | 2019-06-05 17:08:30 0 [Note] mysqld (mysqld 10.3.12-MariaDB-1:10.3.12+maria~bionic) starting as process 1 ... mautic_1 | mautic_1 | Ensuring Mautic database is present mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Using Linux native AIO mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Uses event mutexes mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Compressed tables use zlib 1.2.11 mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Number of pools: 1 mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Using SSE2 crc32 instructions mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Initializing buffer pool, total size = 256M, instances = 1, chunk size = 128M mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Completed initialization of buffer pool mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority(). mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: 128 out of 128 rollback segments are active. mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Creating shared tablespace for temporary tables mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ... mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB. mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: 10.3.12 started; log sequence number 1630842; transaction id 21 mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool mariadb_1 | 2019-06-05 17:08:30 0 [Note] Plugin 'FEEDBACK' is disabled. mariadb_1 | 2019-06-05 17:08:30 0 [Note] Server socket created on IP: '::'. mariadb_1 | 2019-06-05 17:08:30 0 [Warning] 'proxies_priv' entry '@% root@73d6597df770' ignored in --skip-name-resolve mode. mariadb_1 | 2019-06-05 17:08:30 0 [Note] Reading of all Master_info entries succeded mariadb_1 | 2019-06-05 17:08:30 0 [Note] Added new Master_info '' to hash table mariadb_1 | 2019-06-05 17:08:30 0 [Note] mysqld: ready for connections. mariadb_1 | Version: '10.3.12-MariaDB-1:10.3.12+maria~bionic' socket: '/var/run/mysqld/mysqld.sock' port: 3306 mariadb.org binary distribution mariadb_1 | 2019-06-05 17:08:30 0 [Note] InnoDB: Buffer pool(s) load completed at 190605 17:08:30 mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | Warning: mysqli::__construct(): (HY000/2002): Connection refused in /makedb.php on line 20 mautic_1 | mautic_1 | MySQL Connection Error: (2002) Connection refused progettodockermautic_mautic_1 exited with code 1 ^CGracefully stopping... (press Ctrl+C again to force) Stopping progettodockermautic_mariadb_1 ... done

Would anyone be kind enough to tell me how to solve?

Thank you all for any contributions

I love you, I'll buy a cat soon


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

UtenteWeb avatar Jun 05 '19 17:06 UtenteWeb

You need to setup the database

The compose.yml is inly a example

luizeof avatar Jun 10 '19 11:06 luizeof

Hi, I am having the same issue. I tried with the plain docker version as the example version (not with docker-compose), and ended up with the same issue as this. Could you please elaborate on what needs to be setup as the database? is the MySQL DB up and running and linked to the mautic docker is not sufficient?

Any help on this would be greatly appreciated.

sriram18981 avatar Jul 12 '19 10:07 sriram18981

Use following setup with correct MAUTIC_DB_HOST=172.17.0.2 for your environment. Find IP using this way: docker ps

note CONTAINER_ID

docker inspect CONTAINER_ID | grep IP --- docker-compose.yml -- mautic: image: mautic/mautic:latest links: - mauticdb:mysql ports: - 8081:81 volumes: - mautic_data:/var/www/html environment: - MAUTIC_DB_HOST=172.17.0.2 - MYSQL_PORT_3306_TCP=3306 - MAUTIC_DB_USER=root - MAUTIC_DB_PASSWORD=mysecret - MAUTIC_DB_NAME=mautic

mauticdb: image: mysql:5.6 ports: - 3306:3306 environment: - MYSQL_ROOT_PASSWORD=mysecret -- end of file --- docker-compose.yml--

bohuspollak avatar Aug 16 '19 15:08 bohuspollak

I had the same issue but finally got this docker-compose.yml file to work. https://gitlab.com/snippets/1894892 . I guess there must be a difference between how the Percona and MySQL images are built because MySQL logs showed a login failure.

toman avatar Sep 14 '19 20:09 toman

I had the same issue but finally got this docker-compose.yml file to work. https://gitlab.com/snippets/1894892 . I guess there must be a difference between how the Percona and MySQL images are built because MySQL logs showed a login failure.

not work for me :´(

eltonjosesouza avatar Sep 30 '19 21:09 eltonjosesouza

Yes to be clear this process should work:

  1. find CONTAINER ID of percona server with docker ps
  2. find IP address of container with docker inspect CONTAINER ID | grep IPAddress
  3. change MAUTIC_DB_HOST in script to MAUTIC_DB_HOST=IPAddress:3306

nickwild-999 avatar Mar 27 '20 10:03 nickwild-999

Really at a loss. This doesn't work for me at all. Once I look up the IP, say '172.17.0.2' then set the host for it while adding the port ":3306", I get the error "Access denied for user 'root'@'172.17.0.4' (using password: Y". It's as if the system can't find the db whatsoever. TIA for any tips & tricks. I've been considering hard coding the IP for the dbase container?

weisisheng avatar Jul 19 '21 06:07 weisisheng

It must MAUTIC_DB_USER=root, then it running ok

chendelin1982 avatar Nov 22 '22 07:11 chendelin1982