Mail problem with mysql connectivity

Discussion in 'Installation/Configuration' started by mislav, Oct 21, 2016.

  1. mislav

    mislav Member

    Hi there.
    - Linux Distribution and version used on your server - Debian 8
    - ISPConfig version - 3.0.5.4p9

    The problem is basically connected with mysql and postfix. On two servers I've faced this problem, however I'm running multiple ispconfig servers under same version and so far no problems there.
    In the mail log you can see the following:
    Because of that there is Server configuration error since lookup table fails - mail server is not working and you can't send emails. Before restarting any services I've tried to log in manually to mysql using user root and ispconfig user in that file = no problems at all. Mysql was showing historical max connections ever used 34 - which is maybe 10% of the max connections defined.
    Any idea why mysql is rejecting connections, even though I can log in manually and user limit is not reached? Mysql error log is not showing anything apart from "can't connect" from postfix.
     
  2. mislav

    mislav Member

    The same problem happened on another server. I've tried to connect with flag -h like so:
    Of course, ispconfig was failing to connect to mysql and thus resulting table lookup problem. I've tried to connect via localhost and that worked just fine.

    skip_name_resolve is OFF in mysql and mysql is binded to localhost. I've such conf in multiple servers and all is fine there. Any idea what is wrong? How come all of the sudden postfix/mysql stop resolving localhost/127.0.0.1 ?
     
  3. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    If using 'localhost' works, it's probably using a unix socket. Is mysql listening on localhost or on all addresses (eg. check 'netstat -tna | grep 3306' or 'lsof -i :3306')? Are there firewall rules blocking the connection? If you can connect to the socket (eg. test with 'telnet 127.0.0.1 3306') maybe permissions are wrong in the mysql.users table?
     
  4. mislav

    mislav Member

    Bind address for mysql is 127.0.0.0.1 - there are no firewall rules for localhost/127.0.0.1. This is default user from ispconfig - I've compared to other installations and users table looks the same/fine.
     
  5. florian030

    florian030 Well-Known Member HowtoForge Supporter

    Can you telnet to mysql?
    Is mysql listening on port 3306?
    Is mysql really running? stop mysql and run ps -ef|grep sql
     
  6. mislav

    mislav Member

    During the problem I could telnet and connect to mysql via localhost - 127.0.0.1 was not working as mentioned.

    Mysql was/is listening on port 3306 and it was running as I was able to connect via localhost/get status and pid.
     
  7. till

    till Super Moderator Staff Member ISPConfig Developer

    Localhost means connect to the MySQl socket file while a connect to 127.0.0.1 is a connect to the IP. so there must be a problem with your networking. Did you try to reboot the whle server?
     
  8. mislav

    mislav Member

    Yes, that was also tested on one server - it didn't help. There were still entries in the log file about failed connectivity to mysql.
    I somehow noticed that it could be maybe related to apf-firewall, but so far I'm unable to find exact problem. That's why I'm checking if there could be maybe some issue on the ispconfig side - although I know it's working in my other environments.
     
  9. till

    till Super Moderator Staff Member ISPConfig Developer

    ISPConfig is not involved in the connection between postfix and mysql.
     
  10. mislav

    mislav Member

    How come? There is ispconfig user that is connecting to dbispconfig for lookup tables in mysql-virtual_*.cf and those are defined in postfix main.cf file? If that fails - MTA breaks and you can't send emails.
     
  11. till

    till Super Moderator Staff Member ISPConfig Developer

    Correct, so you see that ispconfig is not involved. It is postfix which connects directly to mysql, the username that it uses does not matter, and this connection fails. so you have to check your mysql and networking setup to find out why mysql is not able to accept connections on IP 127.0.0.1.

    Have you checked the /etc/hosts file, does it contain a line for IP 127.0.0.1 and is the hostname localhost assigned to that IP?
     
  12. mislav

    mislav Member

    I will check that, it's definitely somewhere there related.
    About your question - yes, line exists in hosts file.
     
  13. Jesse Norell

    Jesse Norell Well-Known Member Staff Member Howtoforge Staff

    'telnet 127.0.0.1 3306' - does that connect? If not, it could well be a firewall issue (disable your firewall and test, and/or post the rules (iptables -L -n -v) here and someone can probably point out where the problem is).
     
  14. mislav

    mislav Member

    If it happens again, will do so. Thanks everyone for the help!
     

Share This Page