From 4d470f34050cfe80da11b4da7dfe60efdf5486a8 Mon Sep 17 00:00:00 2001 From: Tom Keffer Date: Wed, 12 Nov 2025 13:33:07 -0800 Subject: [PATCH] Include instructions on making sure MySQL/MariaDB starts before WeeWX Alternative to PR #1030. --- docs_src/usersguide/mysql-mariadb.md | 11 +++++++++++ src/weewx_data/util/systemd/weewx.service | 8 ++++++++ 2 files changed, 19 insertions(+) diff --git a/docs_src/usersguide/mysql-mariadb.md b/docs_src/usersguide/mysql-mariadb.md index 2b2c7554..f1abff6e 100644 --- a/docs_src/usersguide/mysql-mariadb.md +++ b/docs_src/usersguide/mysql-mariadb.md @@ -91,3 +91,14 @@ again assuming user `weewx` with password `weewx`. Adjust as necessary. CREATE USER 'weewx'@'localhost' IDENTIFIED BY 'weewx'; GRANT select, update, create, delete, insert, alter, drop ON weewx.* TO weewx@localhost; ``` + +### 5. Make sure MySQL/MariaDB starts before WeeWX + +You may want to add the following to your `weewx.service` file (generally +located in `/etc/systemd/system/weewx.service`), under the `[Unit]` section: + +```ini +After=mariadb.service mysqld.service +Wants=mariadb.service mysqld.service +``` +This will ensure that MySQL/MariaDB starts before WeeWX. \ No newline at end of file diff --git a/src/weewx_data/util/systemd/weewx.service b/src/weewx_data/util/systemd/weewx.service index ff16cbab..df3f8613 100644 --- a/src/weewx_data/util/systemd/weewx.service +++ b/src/weewx_data/util/systemd/weewx.service @@ -8,6 +8,14 @@ After=time-sync.target Wants=network-online.target After=network-online.target +# If you are using MySQL uncomment the following lines: +# After=mysqld.service +# Wants=mysqld.service + +# If you are using MariaDB uncomment the following lines: +# After=mariadb.service +# Wants=mariadb.service + [Service] ExecStart=WEEWX_PYTHON WEEWXD WEEWX_CFGDIR/weewx.conf StandardOutput=null