Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-15 Thread Thomas Keffer
Thanks, Theo, for your digging and, thanks to you, I learned something. In general, we don't mention these things in the weewx documentation, as they are part of the MySQL / Maria admin world. Indeed, there are many other such database admin comments we could add, such as the use of triggers,

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-15 Thread Theophanis Kontogiannis
Hi Tom, I read through this: http://mysql-python.sourceforge.net/MySQLdb.html#id6 And I think that the magic words are: *Okay, so you want to use _mysql anyway. Here are some examples.* *The simplest possible database connection is:*

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-14 Thread Thomas Keffer
I think you're right. >>> from MySQLdb import connect >>> # No port number specified: >>> conn = connect(host='localhost', user='weewx',passwd='weewx') >>> conn.get_host_info() 'Localhost via UNIX socket' >>> conn.close() >>> # Add a port number: >>> conn = connect(host='localhost',

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-14 Thread Theophanis Kontogiannis
This is not what I got after testing it. Please read in line the per use case test result (with the new mysql.py code) On Tuesday, March 14, 2017 at 10:02:12 PM UTC+2, Tom Keffer wrote: > > Let me try again: > >- If hostname is localhost *or 127.0.0.1*, but no port is supplied: >use

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-14 Thread Thomas Keffer
Let me try again: - If hostname is localhost *or 127.0.0.1*, but no port is supplied: use sockets. - If hostname is localhost* or 127.0.0.1*, but a port is supplied: use TCP/IP. - If hostname is anything else, use TCP/IP. If you want to use sockets, you should *not* specify a port

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-14 Thread Theophanis Kontogiannis
Negative Tom Replaced with new code. weewx does not complain any more for the port number not being integer, but still tries to access the DB via the standard socket and not via TCP/IP Would it not be more simple to just document the two cases? 1) socket ---> host=localhost 2) TCP/IP--->

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-14 Thread Thomas Keffer
You did provide the right syntax. The problem is that the driver did not convert the option to an integer before using it. Fixed in commit 163d7da . Replace your copy of weedb/mysql.py with this copy

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-14 Thread Theophanis Kontogiannis
Hi. Changed the config to: [[MySQL]] driver = weedb.mysql # The host where the database is located * host = localhost* * port = 3306 * # The user name for logging in to the host user = weewx # The password for the user name. Put in quotes to

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-13 Thread Thomas Keffer
Here's how I understand it: - If hostname is localhost, but no port is supplied: use sockets. - If hostname is localhost, but a port is supplied: use TCP/IP. In version 3.6.x, you were in situation #2. With version 3.7.x, you are in #1. -tk On Mon, Mar 13, 2017 at 3:58 PM, Theophanis

Re: [weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-13 Thread Theophanis Kontogiannis
Hi Tom, Thank you for the follow up. Actually the standard MySQL/MariaDB way is to use sockets if the hostname is localhost. TCP/IP will only be used if the hostname is not localhost, or if an IP is provided. So basically it works now as expected (non standard dirs etc) but had to provide

[weewx-user] Using MariaDB/MySQL with non-standard directories

2017-03-13 Thread Theophanis Kontogiannis
Hello All, I have a mariadb on CEntOS 7.3 with non-standard datadir and socket. The configuration is implemented via drop in files. [root@tweety ~]# cat /etc/my.cnf.d/tweety.cnf [mysqld] datadir=/mnt/services/DBs/mysql socket=/mnt/services/DBs/mysql/mysql.sock [client]