'mod_log_sql_mysql : database connection error

I'm trying to use mod_log_sql to log access log in a mysql database. (The OS is Debian 10) My database config is fine (double checked)... but it doesn't work and the error I get in the appache error.log is :

mod_log_sql_mysql: 
  database connection error: 
    mysql error: Unknown MySQL server host 'loguser' (-2)

My virtualhost.conf has the following:

LogSQLLoginInfo mysql://loguser:password@localhost:3306/apachelogs

Following the pattern driver://username[:password]@hostname[:port]/database

What is strange is that the error shows a confusion between the user and the host:

 params : Unknown MySQL server host 'loguser'  

whereas 'loguser' is the username.

Any ideas where the problem comes from?



Solution 1:[1]

Can you upload any code? I use:

$conn = new mysqli($servername, $username, $password, $dbname); 

To make a connection.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Alasdair Kite