Hi Guys,
I’m having an odd problem when trying to use a remote MySQL server for the db.
The connection to the server works fine, validate confirms that as per below.
====================================
Component | Version |
---|---|
LibreNMS | 1.42.01-21-g32f8a297e |
DB Schema | 258 |
PHP | 7.1.20-1+ubuntu18.04.1+deb.sury.org+1 |
MySQL | 5.7.23-0ubuntu0.18.04.1 |
RRDTool | 1.7.0 |
SNMP | NET-SNMP 5.7.3 |
====================================
[OK] Composer Version: 1.7.1
[OK] Dependencies up-to-date.
[OK] Database connection successful
[OK] Database schema correct
Here is my config.php relevant info also,
$config[‘db_host’] = ‘librenms-ctrl.XXXXX.net’;
$config[‘db_port’] = ‘3306’;
$config[‘db_user’] = ‘librenms’;
$config[‘db_pass’] = ‘XXXXXXXXXXXX’;
$config[‘db_name’] = ‘librenms’;
$config[‘db_socket’] = ‘’;
I ran tcp dump on the MySQL remote server which shows activity when validate runs. I can also log into the remote MySQL server from the local server with the credentials I’ve configured.
The host name can be found using nslookup locally so it is configured correctly and pointing to the correct IP.
When I try browse to the lIbrenms webui I get a MySQL error. No connection to localhost. Is there anywhere else i should be changing dbhost info? It still looking for localhost.
In apache, the error logs shows this.
production.ERROR: LibreNMS\Exceptions\DatabaseConnectException: Could not connect to localhost in /opt/librenms/includes/dbFacile.php:86.
Line 86 is within this
$database_link = @mysqli_connect(‘p:’ . $db_host, $db_user, $db_pass, null, $db_port, $db_socket);
if ($database_link === false) {
$error = mysqli_connect_error();
if ($error == ‘No such file or directory’) {
$error = 'Could not connect to ’ . $db_host;
}
throw new DatabaseConnectException($error);
}
Shouldnt DB host now be the remote server and not the localhost? Am i missing a place to enter the dbhost somewhere?
It was initially configured as localhost when it was first installed but I’ve made post install changes as per above. Any help is appreciated!
Ciaran