For those of us that prefer domain sockets to TCP for mysql.

This just looks for a slash in 'host = ' in the [[MySQL]] stanza of 
weewx.conf and then uses mysql.sock instead of TCP to connect to the 
database.

Regards,
Joe


-- 
You received this message because you are subscribed to the Google Groups 
"weewx-development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/weewx-development/5eeaa553-9b04-499a-8efa-79f9303ca274n%40googlegroups.com.
--- weewx.conf~	2023-02-06 19:26:30.177447000 +0000
+++ weewx.conf	2023-02-06 19:34:40.158927000 +0000
@@ -521,7 +521,7 @@
     # Defaults for MySQL databases
     [[MySQL]]
         driver = weedb.mysql
-        # The host where the database is located
+        # The host where the database is located or the full path to UNIX doamin socket
         host = /var/run/mysql/mysql.sock
         # The user name for logging in to the host
         user = weewx
127d126
<                   Alternatively, the path to the socket mount
137,142c136,137
<         if '/' in host:
<             connection = MySQLdb.connect(unix_socket=host, user=user, passwd=password,
<                                          db=database_name, **kwargs)
<         else:
<             connection = MySQLdb.connect(host=host, port=int(port), user=user, passwd=password,
<                                          db=database_name, **kwargs)
---
>         connection = MySQLdb.connect(host=host, port=int(port), user=user, passwd=password,
>                                      db=database_name, **kwargs)

Reply via email to