FHEM Forum

FHEM => Anfängerfragen => Thema gestartet von: Larusso am 04 März 2019, 11:09:52

Titel: Dblog Verbindung abgelehnt mysql
Beitrag von: Larusso am 04 März 2019, 11:09:52
Hallo zusammen,

ich habe im Forum einige Beiträge gefunden die mir aber nicht weiter helfen konnten. Ich versuche seit ein paar Tagen meine mysql datenbank mit phpmyadmin an dblog anzubinden, bekomme es aber einfach nicht hin. Vielleicht kann mir jemand einen Hilfestellung geben.

Hier das dblog device:
Internals:
   COLUMNS    field length used for Device: 64, Type: 64, Event: 512, Reading: 64, Value: 128, Unit: 32
   CONFIGURATION /opt/fhem/db.conf
   DEF        /opt/fhem/db.conf .*:.*
   FUUID      5c796b38-f33f-5683-926a-74367d533953906e
   MODE       synchronous
   MODEL      MYSQL
   NAME       myDbLog
   NR         75
   NTFY_ORDER 50-myDbLog
   PID        706
   REGEXP     .*:.*
   STATE      connected
   TYPE       DbLog
   UTF8       0
   VERSION    3.13.1
   dbconn     mysql:database=fhem;host=192.168.178.122;port:3306
   dbuser     fhemuser
   HELPER:
     COLSET     1
     DEVICECOL  64
     EVENTCOL   512
     OLDSTATE   DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

     READINGCOL 64
     TYPECOL    64
     UNITCOL    32
     VALUECOL   128
   Helper:
     DBLOG:
       DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed:
         myDbLog:
           TIME       1551657920.06335
           VALUE      Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.

       state:
         myDbLog:
           TIME       1551693345.52301
           VALUE      DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed
   READINGS:
     2019-03-04 10:55:45   state           connected
   cache:
     index      0
Attributes:
   DbLogType  Current/History
   verbose    3


hier meine db.conf

#
# database configuration file
#
#
## for MySQL
################################################################
%dbconfig= (
connection => "mysql:database=fhem;host=192.168.178.122;port:3306",
user => "fhemuser",
password => "fhempassword",
);
################################################################
#
## for PostgreSQL
################################################################
#%dbconfig= (
#        connection => "Pg:database=fhem;host=localhost",
#        user => "fhemuser",
#        password => "fhempassword"
#);
################################################################
#
## for SQLite (username and password stay empty for SQLite)
################################################################
#%dbconfig= (
#        connection => "SQLite:dbname=/opt/fhem/fhem.db",
#        user => "",
#        password => ""
#);
################################################################


Passwort habe ich genauso stehen gelassen......hoffe das passt, ich vermute das es ein Passwort oder Rechte Problem ist beim einloggen in die mysql db

Datenbank "fhem" und Listen "current" und "history" wurden wie im wiki beschrieben in die maria db eingetragen bzw. angelegt.

unten ist noch ein screenshot von myphp admin, dort habe ich zum testen einfach mal zwei user angelegt "fhem" und "fhemuser" um herauszufinden wo mein Fehler liegt Das Passwort zum Testen der User ist "larusso1" hier ist auch schon meine erste Frage......muss das Passwort nicht "fhempassword" heisen wie in der db.conf oder verstehe ich da etwas falsch? Beide User haben alle rechte und können nicht nur lokal auf die db zuzugreifen. Quasi alles offen gemacht um herauszufinden warum fhem nicht mit der db sprechen kann.

Wie man auf den Bildern sieht ist die Datenbank leer, verbinden kann ich mich mit der db über putty und auch neue Tabellen anlegen, alles funktioniert soweit ich das sagen kann, nur die Verbindung von dblog zur mysql db wird abgelehnt. Im Internet habe ich dazu einige Ansätze gefunden aber auch diese konnten mir bei meinem Problem nicht helfen. Ist bestimmt etwas sehr triviales.....

hier auch noch der configcheck

Result of DbLog version check

Used DbLog version: 3.13.1
Recommendation: Your running version may be the current one. Please check for updates of DbLog periodically.

Result of configuration read check

Connection parameter store type: file
Connection parameter: Connection -> mysql:database=fhem;host=192.168.178.122;port:3306, User -> fhemuser, Password -> read o.k.

Result of connection check

Connection to database was not successful.
Recommendation: Plese check logfile for further information.


und ein Auszug aus dem logfile unter verbose "5":

2019.03.04 11:07:51 4: DbLog myDbLog -> ################################################################
2019.03.04 11:07:51 4: DbLog myDbLog -> ###              start of new Logcycle                       ###
2019.03.04 11:07:51 4: DbLog myDbLog -> ################################################################
2019.03.04 11:07:51 4: DbLog myDbLog -> number of events received: 1 for device: myDbLog
2019.03.04 11:07:51 4: DbLog myDbLog -> check Device: myDbLog , Event: state: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.

2019.03.04 11:07:51 5: DbLog myDbLog -> parsed Event: myDbLog , Event: state: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.

2019.03.04 11:07:51 4: DbLog myDbLog -> added event - Timestamp: 2019-03-04 11:07:51, Device: myDbLog, Type: DBLOG, Event: state: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.
, Reading: state, Value: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed, Unit: Can't connect to MySQL server on
2019.03.04 11:07:51 2: DbLog myDbLog - DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.

2019.03.04 11:07:51 5: DbLog myDbLog -> DbLog_Push Returncode:
2019.03.04 11:07:51 5: DbLog myDbLog -> DbLog_Push Returncode:
2019.03.04 11:07:51 4: DbLog myDbLog -> ################################################################
2019.03.04 11:07:51 4: DbLog myDbLog -> ###              start of new Logcycle                       ###
2019.03.04 11:07:51 4: DbLog myDbLog -> ################################################################
2019.03.04 11:07:51 4: DbLog myDbLog -> number of events received: 1 for device: myDbLog
2019.03.04 11:07:51 4: DbLog myDbLog -> check Device: myDbLog , Event: state: connected
2019.03.04 11:07:51 5: DbLog myDbLog -> parsed Event: myDbLog , Event: state: connected
2019.03.04 11:07:51 4: DbLog myDbLog -> added event - Timestamp: 2019-03-04 11:07:51, Device: myDbLog, Type: DBLOG, Event: state: connected, Reading: state, Value: connected, Unit:
2019.03.04 11:07:51 2: DbLog myDbLog - DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.

2019.03.04 11:07:51 5: DbLog myDbLog -> DbLog_Push Returncode:
2019.03.04 11:07:52 3: DbLog myDbLog - Creating Push-Handle to database mysql:database=fhem;host=192.168.178.122;port:3306 with user fhemuser
2019.03.04 11:07:52 2: DbLog myDbLog - Error: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:07:52 4: DbLog myDbLog - Trying to connect to database
2019.03.04 11:07:52 4: DbLog myDbLog -> ################################################################
2019.03.04 11:07:52 4: DbLog myDbLog -> ###              start of new Logcycle                       ###
2019.03.04 11:07:52 4: DbLog myDbLog -> ################################################################
2019.03.04 11:07:52 4: DbLog myDbLog -> number of events received: 1 for device: myDbLog
2019.03.04 11:07:52 4: DbLog myDbLog -> check Device: myDbLog , Event: state: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:07:52 5: DbLog myDbLog -> parsed Event: myDbLog , Event: state: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:07:52 4: DbLog myDbLog -> added event - Timestamp: 2019-03-04 11:07:52, Device: myDbLog, Type: DBLOG, Event: state: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.
, Reading: state, Value: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed, Unit: Can't connect to MySQL server on
2019.03.04 11:07:52 2: DbLog myDbLog - DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2466.

2019.03.04 11:07:52 5: DbLog myDbLog -> DbLog_Push Returncode:
2019.03.04 11:07:52 4: DbLog myDbLog - Waiting for database connection
2019.03.04 11:07:57 3: DbLog myDbLog - Creating Push-Handle to database mysql:database=fhem;host=192.168.178.122;port:3306 with user fhemuser
2019.03.04 11:07:57 2: DbLog myDbLog - Error: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:07:57 4: DbLog myDbLog - Trying to connect to database
2019.03.04 11:07:57 4: DbLog myDbLog - Waiting for database connection
2019.03.04 11:08:02 3: DbLog myDbLog - Creating Push-Handle to database mysql:database=fhem;host=192.168.178.122;port:3306 with user fhemuser
2019.03.04 11:08:02 2: DbLog myDbLog - Error: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:08:02 4: DbLog myDbLog - Trying to connect to database
2019.03.04 11:08:02 4: DbLog myDbLog - Waiting for database connection
2019.03.04 11:08:07 3: DbLog myDbLog - Creating Push-Handle to database mysql:database=fhem;host=192.168.178.122;port:3306 with user fhemuser
2019.03.04 11:08:07 2: DbLog myDbLog - Error: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:08:07 4: DbLog myDbLog - Trying to connect to database
2019.03.04 11:08:07 4: DbLog myDbLog - Waiting for database connection
2019.03.04 11:08:12 3: DbLog myDbLog - Creating Push-Handle to database mysql:database=fhem;host=192.168.178.122;port:3306 with user fhemuser
2019.03.04 11:08:12 2: DbLog myDbLog - Error: DBI connect('database=fhem;host=192.168.178.122;port:3306','fhemuser',...) failed: Can't connect to MySQL server on '192.168.178.122' (111 "Verbindungsaufbau abgelehnt") at ./FHEM/93_DbLog.pm line 2401.

2019.03.04 11:08:12 4: DbLog myDbLog - Trying to connect to database
2019.03.04 11:08:12 4: DbLog myDbLog - Waiting for database connection

jump to the top

Titel: Antw:Dblog Verbindung abgelehnt mysql
Beitrag von: Frank_Huber am 04 März 2019, 11:20:25
dein MySQL ist scheinbar noch auf localhost beschränkt.

schau mal hier: https://forum.fhem.de/index.php/topic,34406.msg267325.html#msg267325
Titel: Antw:Dblog Verbindung abgelehnt mysql
Beitrag von: Larusso am 04 März 2019, 11:56:17
Super, hat geklappt. Allerdings liegt bei maria db die config Datei in anderen Ordnern und heisst anders. Vielen dank für die schnelle Hilfe endlich kann ich grafana einrichten, super. ;D

Leider habe ich jetzt ein neues Problem mit meinem zweiten Raspberry......

Da ich auf mehreren Ebenen Aktoren und Sensoren habe benutze ich zwei Raspberrys mit Fhem, auf dem zweiten Raspberry habe ich eine sqlite db drauf, nun möchte ich aber alle Datensätze in die mySQL db auf meinem anderen Pi loggen und bekomme nach dem define der logDB in fhem eine Fehlermeldung im state

install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./FHEM/lib ./lib . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base ./FHEM) at (eval 9582824) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 2400.


muss ich auch auf dem pi wo ich nur die Daten zum anderen pi schicken möchte (Fernverbindung zur mySQL db) auch einen mySQL clienten einrichten? In der db.conf ist alles richtig hinterlegt.

hier die list vom device

Internals:
   CFGFN     
   COLUMNS    field length used for Device: 64, Type: 64, Event: 512, Reading: 64, Value: 128, Unit: 32
   CONFIGURATION ./db.conf
   DEF        ./db.conf .*:.*
   FUUID      5c7d0aca-f33f-7f1e-cadd-bf12a3d414b5d250
   MODE       synchronous
   MODEL      MYSQL
   NAME       logdb
   NR         35548
   NTFY_ORDER 50-logdb
   PID        1323
   REGEXP     .*:.*
   STATE      install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./FHEM/lib ./lib . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base ./FHEM) at (eval 9586028) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 2400.

   TYPE       DbLog
   UTF8       0
   VERSION    3.13.0
   dbconn     mysql:database=fhem;host=192.168.178.122;port=3306
   dbuser     root
   .attraggr:
   .attrminint:
   HELPER:
     COLSET     1
     DEVICECOL  64
     EVENTCOL   512
     OLDSTATE   install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./FHEM/lib ./lib . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base ./FHEM) at (eval 9586028) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 2400.

     READINGCOL 64
     TYPECOL    64
     UNITCOL    32
     VALUECOL   128
   Helper:
     DBLOG:
       state:
         logdb:
           TIME       1551698810.88074
           VALUE      connected
   READINGS:
     2019-03-04 12:26:50   state           install_driver(mysql) failed: Can't locate DBD/mysql.pm in @INC (you may need to install the DBD::mysql module) (@INC contains: ./FHEM/lib ./lib . /etc/perl /usr/local/lib/arm-linux-gnueabihf/perl/5.24.1 /usr/local/share/perl/5.24.1 /usr/lib/arm-linux-gnueabihf/perl5/5.24 /usr/share/perl5 /usr/lib/arm-linux-gnueabihf/perl/5.24 /usr/share/perl/5.24 /usr/local/lib/site_perl /usr/lib/arm-linux-gnueabihf/perl-base ./FHEM) at (eval 9586028) line 3.
Perhaps the DBD::mysql perl module hasn't been fully installed,
or perhaps the capitalisation of 'mysql' isn't right.
Available drivers: DBM, ExampleP, File, Gofer, Proxy, SQLite, Sponge.
at ./FHEM/93_DbLog.pm line 2400.

   cache:
     index      0
Attributes:


configcheck


Result of DbLog version check

Used DbLog version: 3.13.0
Recommendation: Your running version may be the current one. Please check for updates of DbLog periodically.

Result of configuration read check

Connection parameter store type: file
Connection parameter: Connection -> mysql:database=fhem;host=192.168.178.122;port=3306, User -> root, Password -> read o.k.

Result of connection check

Connection to database was not successful.
Recommendation: Plese check logfile for further information.
Titel: Antw:Dblog Verbindung abgelehnt mysql
Beitrag von: Frank_Huber am 04 März 2019, 19:02:03
Sudo apt-get update && apt-get install libdbd-mysql-perl
Sollte hier helfen.

Gesendet von meinem Doogee S60 mit Tapatalk

Titel: Antw:Dblog Verbindung abgelehnt mysql
Beitrag von: DS_Starter am 04 März 2019, 23:49:33
Ergänzend noch der client falls er nicht mitkommt:

sudo apt-get install mysql-client