Poller-wrapper can not access mysql; php does

Somehow my poller stopped working:

librenms@nms:~$ ./poller-wrapper.py
ERROR: Could not connect to MySQL database!
ERROR: (1045, "Access denied for user 'librenms'@'127.0.0.1' (using password: YES)")

installation is valid:

user@nms:/opt/librenms$ sudo ./validate.php
====================================
Component | Version
--------- | -------
LibreNMS  | 1.63-106-g370c7f566
DB Schema | 2020_04_13_150500_add_last_error_fields_to_bgp_peers (164)
PHP       | 7.3.14-1~deb10u1
Python    | 3.7.3
MySQL     | 10.3.22-MariaDB-0+deb10u1
RRDTool   | 1.7.1
SNMP      | NET-SNMP 5.7.3
====================================

[OK]    Composer Version: 1.10.6
[OK]    Dependencies up-to-date.
[OK]    Database connection successful
[OK]    Database schema correct

Both the poller.php and the discovery.php script run fine. Debian 10; packages installed as documented in the installer.

Any thoughts?

Goedemiddag,

Does mysql cli client work normally? Are your credentials in .env good and do not contain spaces?

Goedemiddag :slight_smile:

user@nms:/opt/librenms$ grep " $" .env
user@nms:/opt/librenms$ grep DB .env
DB_HOST=localhost
DB_DATABASE=librenms
DB_USERNAME=librenms
DB_PASSWORD=Pass12$
user@nms:/opt/librenms$ mysql -u librenms -pPass12$ librenms
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 4066896
Server version: 10.3.22-MariaDB-0+deb10u1 Debian 10

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

As far as I can see it seems python related; not MySQL/MariaDB

I’ve changed the password to just [A-Z][a-z] characters but no success. ./validate connects without problems; poller-wrapper.py does not. /var/log/mysql/error.log:

2020-05-20 17:25:34 5282 [Warning] Access denied for user 'librenms'@'localhost' (using password: YES)

Try to use the ipv4 or ipv6 loopback address instead of localhost to see if that makes a difference.

You have 2 options:

  1. Add librenms@::1 user like the ipv4 one
  2. Change localhost with 127.0.0.1 as db_host in both .env and config.php

Using 127.0.0.1 in .env and config.php kills validate.php. Adding ‘librenms’@‘::1’ to the mysql user tabel makes no difference :slightly_frowning_face:

For quick fix, configure to use socket, but something happens there as adding ::1 (with the same password, of course) should have fixed it, or at least moving to 127.0.0.1.

Thanx for all the suggestions. I ended up reinstalling Mariadb and restoring from backup.

I have this issue too

I had an issue with python3-mysqldb which I didn’t have installed.

i have same issue and this my solution,
first, change the host of the DB_USERNAME to 127.0.0.1 on mysql.user then also update librenms database user privileges from @‘localhost’ to @‘127.0.0.1’
after all changes DB_HOST on .env and config.php

i don’t know why poller-wrapper of the new version librenms can’t read the @‘localhost’ but validate.php can.

Its a Python 3 thing