1

I am trying to connect to MariaDB with using HAProxy load balancer, but when I try to connect to HAProxy it returns that error. I tried all the links on the stackoverflow about this error but they did not work for me. What should I do?

2013 - Lost connection to MySQL server at 'reading initial communication packet',
system error: 0 "Internal error/check (Not system error)"

I have MariaDB Galera cluster with 3 nodes and HAProxy configuratios that I used are below.

listen testgalera
    bind 10.131.63.83:3306
    balance source
    mode tcp
    option tcpka
    option mysql-check user haproxy
    server db1 10.131.60.8:3306 check weight 1
    server db2 10.131.60.35:3306 check weight 1
    server db3 10.131.61.117:3306 check weight 1
Emrah Tema
  • 335
  • 3
  • 9

2 Answers2

2

Most of HAProxy with Galera tutorials uses the given configurations but one row causes the error and if we delete it nothing changes, the HAProxy works well without the row "option mysql-check user haproxy"

The HAProxy configuration must be like this for MariaDB Galera clusters:

listen testgalera
    bind 10.131.63.83:3306
    balance source
    mode tcp
    option tcpka
    server db1 10.131.60.8:3306 check weight 1
    server db2 10.131.60.35:3306 check weight 1
    server db3 10.131.61.117:3306 check weight 1
Emrah Tema
  • 335
  • 3
  • 9
0

If you tried all other options, Just make sure that root is allowed to connect from other IP. By default it is allowed to connect from 127.0.0.1 (local-host). To check:

  • Go to PHP-my-admin
  • Go to user accounts
  • check the host name column against root. -if you cant find your host , please create another user giving required privileges to that user and mention host name as IP of the computer from which you like to connect.

-if connecting from workbench 8.0 or above, please do not forget to add "useSSL=0" in advanced tab if you not using SSL.