Yeap looks correct.

So basically in my 3.7.x case, setting "*host=127.0.0.1*" (replace 
localhost with the IP for the localhost) did the trick to force TCP/IP 
connection.

Will test the localhost/port combination to check if it gives the same 
result.

We are in tune.

Thank you
Theo


On Tuesday, March 14, 2017 at 1:05:56 AM UTC+2, Tom Keffer wrote:
>
> 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 Kontogiannis <[email protected] 
> <javascript:>> wrote:
>
>> 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 the ip address for the localhost (127.0.0.1) to force TCP/IP 
>> connection.
>>
>> Should it be documented?
>>
>> Best regards,
>>
>> Theo
>>
>>
>>
>> On Tuesday, March 14, 2017 at 12:54:35 AM UTC+2, Tom Keffer wrote:
>>>
>>> Yes, the code did change.
>>>
>>> Before, it always passed in the hostname and port, which caused MySQL to 
>>> always use a TCP/IP connection. Now it adds the port only if the hostname 
>>> is 'localhost' or '127.0.0.1'. 
>>>
>>> I suspect that you were connecting via TCP/IP all along. The change just 
>>> exposed the problem. But, I'm not a MySQL (let alone MariaDB) expert!
>>>
>>> Try Googling "Can't connect to local MySQL server through socket 
>>> '/var/lib/mysql/mysql.sock' " and see what you come up with. You may have 
>>> to configure your installation explicitly to use /var/lib/mysql/mysql.sock.
>>>
>>> -tk
>>>
>>>
>>>
>>> On Mon, Mar 13, 2017 at 3:01 PM, Theophanis Kontogiannis <
>>> [email protected]> wrote:
>>>
>>>> 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]
>>>>
>>>> socket=/mnt/services/DBs/mysql/mysql.sock
>>>>
>>>>
>>>> The weewx configuration is:
>>>>
>>>>    [[MySQL]]
>>>>         driver = weedb.mysql
>>>>         # The host where the database is located
>>>>         host = *localhost*
>>>>         # The user name for logging in to the host
>>>>         user = weewx
>>>>         # The password for the user name. Put in quotes to guard 
>>>> against parsing errors.
>>>>         password = *****
>>>>
>>>>
>>>> I keep on getting an error on weewx launch:
>>>>
>>>> engine: Database OperationalError exception: (2002, "Can't connect to 
>>>> local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)")
>>>>
>>>>
>>>>
>>>> Tried to 'setenforce 0' but I get the same error.
>>>>
>>>> Tried to add the non-standard socket in the /etc/my.cnf main config 
>>>> file still no luck.
>>>>
>>>> The only way to make it work is to change the weewx.conf to force it 
>>>> use the TCP/IP connector instead of the default socket connector.
>>>>
>>>>     [[MySQL]]
>>>>
>>>> # The host where the database is located
>>>>
>>>> host = *127.0.0.1*
>>>>
>>>>
>>>> Is the socket location hard coded in the weedb.mysql?
>>>>
>>>> Is there something else I am doing wrong or missed in the documentation?
>>>>
>>>> Is there something that should be changed in the code or added in the 
>>>> documentation?
>>>>
>>>> Thank you for your time.
>>>>
>>>>
>>>>  
>>>>
>>>> -- 
>>>> 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].
>>>> For more options, visit https://groups.google.com/d/optout.
>>>>
>>>
>>> -- 
>> 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] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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].
For more options, visit https://groups.google.com/d/optout.

Reply via email to