Ad Widget

Collapse

Only zabbix-server cannot connect to remote MySQL DB

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • jeremyhb
    Junior Member
    • Aug 2019
    • 2

    #1

    Only zabbix-server cannot connect to remote MySQL DB

    I have installed Zabbix 4.0.11 on CentOS 7.6. Zabbix server and the web UI are on one VM and the MySQL database is on a separate CentOS 7.6 VM.

    I can connect to the zabbix database from the Zabbix VM using the mysql command line client and the Zabbix web UI is able to connect to it as well. However, zabbix-server cannot connect despite using the same password, username, and database name.

    Code:
    zabbix-vm # cat /etc/zabbix/zabbix_server.conf
    LogFile=/var/log/zabbix/zabbix_server.log
    LogFileSize=0
    PidFile=/var/run/zabbix/zabbix_server.pid
    SocketDir=/var/run/zabbix
    DBHost=10.0.0.1
    DBName=zabbix
    DBUser=zabbix
    DBPassword='password'
    SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
    Timeout=4
    AlertScriptsPath=/usr/lib/zabbix/alertscripts
    ExternalScripts=/usr/lib/zabbix/externalscripts
    LogSlowQueries=3000
    Code:
    zabbix-vm # tail /var/log/zabbix/zabbix_server.log
     12012:20190806:234641.436 Ez Texting notifications:   YES
     12012:20190806:234641.436 ODBC:                      YES
     12012:20190806:234641.436 SSH2 support:              YES
     12012:20190806:234641.436 IPv6 support:              YES
     12012:20190806:234641.436 TLS support:               YES
     12012:20190806:234641.436 ******************************
     12012:20190806:234641.436 using configuration file: /etc/zabbix/zabbix_server.conf
     12012:20190806:234641.445 [Z3001] connection to database 'zabbix' failed: [1045] Access denied for user 'zabbix'@'10.0.0.2' (using password: YES)
     12012:20190806:234641.445 database is down: reconnecting in 10 seconds
    Code:
    mysql-vm # tail /var/log/mysqld.log
    ...
    2019-08-07T06:46:41.444876Z 357039 [Note] Access denied for user 'zabbix'@'10.0.0.2' (using password: YES)
    2019-08-07T06:46:50.240596Z 357040 [Note] Access denied for user 'zabbix'@'10.0.0.2' (using password: YES)
  • Markku
    Senior Member
    Zabbix Certified SpecialistZabbix Certified ProfessionalZabbix Certified Expert
    • Sep 2018
    • 1781

    #2
    Hi, do you have the password quoted in the zabbix_server.conf? It shouldn’t be quoted in that file.

    DBPassword=yourpassword_with_no_quotes

    Markku

    Comment

    • jeremyhb
      Junior Member
      • Aug 2019
      • 2

      #3
      Thank you Markku, the quotes were indeed causing the 'Access denied' issue.

      After removing the quotes around the DB password, zabbix-server failed to start due to permission issues on the socket files. This problem report explained that issue and how to resolve it.


      Comment

      Working...