Only a few sections need to be changed from the standard weewx.conf file.
I've highlighted them below. Everything else should be the same.
# 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_mysql
# 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 = schemas.wview_extended.schema
##############################################################################
# This section defines various databases.
[Databases]
# A SQLite database is simply a single file.
[[archive_sqlite]]
database_name = weewx.sdb
database_type = SQLite
# MySQL
[[archive_mysql]]
database_name = weewx
database_type = MySQL
##############################################################################
# This section defines defaults for the different types of databases.
[DatabaseTypes]
# Defaults for SQLite databases.
[[SQLite]]
driver = weedb.sqlite
# Directory in which database files are located, relative to
WEEWX_ROOT
SQLITE_ROOT = archive
# Defaults for MySQL databases.
[[MySQL]]
driver = weedb.mysql
# The host where the database is located.
host = 192.168.1.100
port = 3306
# The user name for logging in to the host.
user = weewx
# Use quotes around the password to guard against parsing errors.
password = weewx
On Wed, Jan 8, 2025 at 9:37 AM Adam Morgan <[email protected]> wrote:
> Thanks Tom! This is all the part that I find a little confusing - how the
> sections tie together. I did see the note about the db name needing to be
> consistent across sections, but I am unclear if I am missing something
> beyond that.
>
> I have stripped out the sections that don't apply to this task. I have
> commented out the lines that were causing the program to fail.
>
>
>
> ##############################################################################
>
> # 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 = weewx
> # 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 = schemas.wview_extended.schema
>
>
> ##############################################################################
>
> # This section defines various databases.
>
> [Databases]
>
> # A SQLite database is simply a single file.
> [[archive_sqlite]]
> database_name = weewx.sdb
> database_type = SQLite
>
> # MySQL
> [[archive_mysql]]
> database_name = weewx
> database_type = MySQL
>
>
> ##############################################################################
>
> # This section defines defaults for the different types of databases.
>
> [DatabaseTypes]
>
> # Defaults for SQLite databases.
> [[SQLite]]
> driver = weedb.sqlite
> # Directory in which database files are located, relative to
> WEEWX_ROOT
> SQLITE_ROOT = /var/lib/weewx
>
> # Defaults for MySQL databases.
> [[MySQL]]
> #driver = weedb.mysql
> # The host where the database is located.
> #host = 192.168.1.100
> #port = 3306
> # The user name for logging in to the host.
> #user = weewx
> # Use quotes around the password to guard against parsing errors.
> #password = "weewx"
>
>
> ##############################################################################
>
> On Wednesday, January 8, 2025 at 10:39:17 AM UTC-5 Tom Keffer wrote:
>
>> I'm assuming that the section [[MySQL]], which you show as being under
>> [Databases], is actually under [DatabaseTypes].
>>
>> If that's the case, then the problem is that under [[wx_binding]], the
>> option "database" should be set to "archive_mysql", not "weewx".
>>
>> But, if [[MySQL]] is in fact under [Databases], then that has to be
>> corrected. If you get confused, look at the original weewx.conf
>> <https://github.com/weewx/weewx/blob/master/src/weewx_data/weewx.conf>.
>> The comments tell you what to do.
>>
>> On Wed, Jan 8, 2025 at 6:21 AM Adam Morgan <[email protected]> wrote:
>>
>>> I left out this part of the config:
>>>
>>> [[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 = weewx
>>> # 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 = schemas.wview_extended.schema
>>>
>>> On Wednesday, January 8, 2025 at 9:06:28 AM UTC-5 Adam Morgan wrote:
>>>
>>>> Hello, and thank you so much to all of you that work on the software
>>>> and participate in this forum. I've been using weewx for a while now, and
>>>> I hope to be able to contribute to the community going forward.
>>>>
>>>> I am trying to write to a mariadb instance on my network. I have
>>>> several other self-hosted apps on my network that write to the database,
>>>> and there are absolutely no network / port restrictions on the db.
>>>>
>>>> Maybe its just me, but the instructions
>>>> <https://weewx.com/docs/5.0/usersguide/mysql-mariadb/#2-change-the-weewx-configuration-to-use-mysql>
>>>> are a little murky. I am not sure that I have the config right. I can
>>>> connect to the db with the user and password, so I don't think that is the
>>>> issue.
>>>>
>>>> Here are some snippets from my config.
>>>>
>>>> [Databases]
>>>>
>>>> # A SQLite database is simply a single file.
>>>> [[archive_sqlite]]
>>>> database_name = weewx.sdb
>>>> database_type = SQLite
>>>>
>>>> # MySQL
>>>> [[archive_mysql]]
>>>> database_name = weewx
>>>> database_type = MySQL
>>>>
>>>> [[MySQL]]
>>>> driver = weedb.mysql
>>>> # The host where the database is located.
>>>> host = 192.168.1.100
>>>> port = 3306
>>>> # The user name for logging in to the host.
>>>> user = weewx
>>>> # Use quotes around the password to guard against parsing
>>>> errors.
>>>> password = "weewx"
>>>>
>>>>
>>>>
>>>> *Note: I tried appending the port to the end of "host" - same error.*
>>>> here is the error:
>>>>
>>>> admin@WeatherPi:~ $ sudo journalctl -u weewx -f
>>>> Jan 08 08:47:00 WeatherPi weewxd[19901]: weewx.UnknownDatabase: Unknown
>>>> database ''weewx''
>>>> Jan 08 08:47:00 WeatherPi weewxd[19901]: CRITICAL __main__: ****
>>>> manager_dict['database_dict'] =
>>>> get_database_dict_from_config(config_dict, database)
>>>> Jan 08 08:47:00 WeatherPi weewxd[19901]: CRITICAL __main__: ****
>>>>
>>>> [image: weewx.png]
>>>>
>>> --
>>> 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 [email protected].
>>> To view this discussion visit
>>> https://groups.google.com/d/msgid/weewx-user/d5298881-213a-4f70-86d5-09b098677cc5n%40googlegroups.com
>>> <https://groups.google.com/d/msgid/weewx-user/d5298881-213a-4f70-86d5-09b098677cc5n%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>>
>> --
> 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 [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/weewx-user/c22faed6-2b1b-49cb-ac31-cbfb13e09476n%40googlegroups.com
> <https://groups.google.com/d/msgid/weewx-user/c22faed6-2b1b-49cb-ac31-cbfb13e09476n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
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 [email protected].
To view this discussion visit
https://groups.google.com/d/msgid/weewx-user/CAPq0zEC%2BBwGew0einLro3hxP56QMd9YvJfx_S%2BFmsz7eQPKLXg%40mail.gmail.com.