Errors connecting to remote MariaDB server

102 views
Skip to first unread message

Marcus Zurhorst

unread,
Aug 30, 2022, 8:01:22 AM8/30/22
to weewx-user
Hello all,

I am stuck with an error that I do not understand with the configuration of my remote MariaDB server.

What I checked:
- Remote access on my database server is enabled.
- Remote login from the weewx host is working as well.  (confirmed with mariadb -uweewxdb -hdatabase.homenet.local -p;  entered the password and had access)

My weewx.conf file:  (shortened)
[DataBindings]
    [[wx_binding]]
        database = archive_mysql
        table_name = archive
        manager = weewx.manager.DaySummaryManager
        schema = schemas.wview_extended.schema
[Databases]
    # MySQL
    [[archive_mysql]]
        database_name = weewx
        database_type = MySQL
[DatabaseTypes]
    # Defaults for MySQL databases
    [[MySQL]]
        driver = weedb.mysql
        host = database.homenet.local
        user = weewxdb
        password = ComplexPrefix,weewxdb      # tried also with single and double quotes


My assumption is, that the comma in my password might cause trouble.
But I also tried it with 'ComplexPrefix,weewxdb' or "ComplexPrefix,weewxdb", and neither helps.


I get an error in my Python:
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****    File "/usr/share/weewx/weedb/mysql.py", line 54, in gua>
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****      return fn(*args, **kwargs)
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****    File "/usr/share/weewx/weedb/mysql.py", line 136, in __>
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****      connection = MySQLdb.connect(host=host, port=int(port>
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****    File "/usr/lib/python3/dist-packages/MySQLdb/__init__.p>
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****      return Connection(*args, **kwargs)
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****    File "/usr/lib/python3/dist-packages/MySQLdb/connection>
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****      super(Connection, self).__init__(*args, **kwargs2)
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****  TypeError: connect() argument 3 must be str, not list
Aug 30 11:34:46 weewx python3[2909]: weewx[2909] CRITICAL __main__:     ****  Exiting.


What is the next thing that I should try?

Thanks and best regards,
   Marcus

Doug Jenkins

unread,
Aug 30, 2022, 9:29:53 AM8/30/22
to weewx-user
Marcus:

I run MariaDB with my WeeWX Setup and yes using a comma is probably giving you some trouble. WeeWX maybe building a database connection string with your information and the comma is throwing the connection attempt.

I would recommend changing the password to the user account that is accessing the weewx account and omit using a comma or a semicolon. There are enough character/numeral combinations to keep your password strong.

just for reference, here is my MariaDB setup for my station. the password was obviously changed :)

====== WEEWX.CONF START ======
#   This section binds a data store to a database.

[DataBindings]
   
    [[wx_binding]]
        # The database must match one of the sections in [Databases].
        # This is likely to be the only option you would want to change.
        database = archive_mariadb
       
        # The name of the table within the database
        table_name = archive
       
        # The manager handles aggregation of data for historical summaries
        manager = weewx.manager.DaySummaryManager
       
        # The schema defines the structure of the database.
        # It is *only* used when the database is created.
        schema = user.weatherlink_live.schema
   

##############################################################################

#   This section defines various databases.

[Databases]
       
    # MySQL
    [[archive_mariadb]]
        database_name = weewx_davis_vp2
        database_type = MariaDB
   

##############################################################################

#   This section defines defaults for the different types of databases.


[DatabaseTypes]
       
    # Defaults for MySQL databases
    [[MariaDB]]
        driver = weedb.mysql
        # The host where the database is located
        host =  172.16.1.25
        # The user name for logging in to the host
        user = weewx
        # The password for the user name (quotes guard against parsing errors)
        password = password

====== WEEWX.CONF END =====

Doug

Tom Keffer

unread,
Aug 30, 2022, 10:46:47 AM8/30/22
to weewx-user
I have been unable to reproduce this. When I surround the  password with quotes, it correctly interprets it as a single string, not a list of two strings.

Are you sure you correctly quoted the password?

--
You received this message because you are subscribed to the Google Groups "weewx-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to weewx-user+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/weewx-user/f33579fc-2ac0-44bf-a413-a2a1961cddd2n%40googlegroups.com.

Marcus Zurhorst

unread,
Aug 31, 2022, 2:15:42 AM8/31/22
to weewx-user
Dear both,

thanks for your help.
So, I have verified the password once more.  I do not have a typo in my config file.  I can copy the password and paste it into a regular mariadb session, and I can access the server.

In a second step, I have no updated the password and removed the comma char.
The weewx service is now connecting and starts w/o errors.

I am using version 4.8.0 which I have installed in a Debian11-based LXC container in Proxmox. (apt install weewx ....)

Regards,
 Marcus
Reply all
Reply to author
Forward
0 new messages