Meteobridge MySQL service returns socket error **solved**

All about the standard Meteobridge devices based on mobile routers from TP-Link, D-Link, ASUS

Moderator: Mattk

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Meteobridge MySQL service returns socket error **solved**

Post by Larry29936 » Tue Feb 05, 2019 3:03 am

I've been trying to get a MySQL service running on my Linux machine. Both the database and connection to Meteobridge are on the same machine. I'm getting the following error: Failed to connect to MYSQL database: Can't connect to local MySQL server through socket '/tmp' (146). I've double-checked mysql.cnf and mysql.conf and they both point to /var/run/mysqld/mysqld.sock.

I can connect to the database thru a GUI client and thru the terminal. Here are the connection parameters from the GUI client:

Address: localhost:3306
Database: meteobridge
URL: jdbc:mysql://localhost:3306/meteobridge
Server: MySQL[5.7.25-0ubuntu0.18.04.2

Does anyone have any idea why this is happening? It's almost like the function was written for Windows, not Linux.

Screenshot of meteobridge error attached.

Thanks in advance
Attachments
Screenshot at 2019-02-06 07-43-19.png
Screenshot at 2019-02-06 07-43-19.png (122.08 KiB) Viewed 192 times
Last edited by Larry29936 on Thu Feb 07, 2019 1:45 am, edited 1 time in total.

User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Wed Feb 06, 2019 3:53 pm

the issue is the .sock location I think. /tmp will be a folder and not a file. so some configuration issue with mysql is at hand I guess.

can you check any other mysql.sock files exist?

[~] # find / -name mysql.sock

also check for duplicate my.cnf

[~] # find / -name my.cnf

you may need to edit the mysql file and point the .sock file to where you need it.

my.cnf

[mysqld]
socket=/tmp/mysql.sock

then restart mysql.

but lets see what files if any are duplicated.

did you install MySQL yourself or was it already on the system?
Last edited by ConligWX on Wed Feb 06, 2019 5:37 pm, edited 1 time in total.

User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Wed Feb 06, 2019 4:23 pm

failing this, you could try and uninstall mysql and instead use MariaDB. unless your using the db for other applications i guess.

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Wed Feb 06, 2019 5:19 pm

I'm running on a Linux machine and installed MySQL myself thru the terminal command 'sudo apt install mysql'. On Linux, MySQL installs the .sock in the /var/run/mysqld folder. It will not allow copying or moving the file.
Last edited by Larry29936 on Wed Feb 06, 2019 5:22 pm, edited 1 time in total.

User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Wed Feb 06, 2019 5:22 pm

Larry29936 wrote:
Wed Feb 06, 2019 5:19 pm
I'm running on a Linux machine. On Linux, MySQL installs the .sock in the /var/run/mysqld folder. It will not allow copying or moving the file.
it wont allow if the service is running.
Last edited by ConligWX on Wed Feb 06, 2019 5:32 pm, edited 2 times in total.

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Wed Feb 06, 2019 5:26 pm

So, I should stop the service, move the .sock file to the /tmp folder, and edit mysql.cnf and my.cnf?

User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Wed Feb 06, 2019 5:33 pm

Larry29936 wrote:
Wed Feb 06, 2019 5:26 pm
So, I should stop the service, move the .sock file to the /tmp folder, and edit mysql.cnf and my.cnf?
when the service is stopped the socket will be removed, then you edit the cnf file to point where you want it to be placed.

[mysqld]
socket = /tmp/mysql.sock

then restart.

not sure about the mysql.cnf, its usually just one file called my.cnf

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Wed Feb 06, 2019 5:58 pm

Same error after editing my.sql and and restarting mysql.

User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Wed Feb 06, 2019 8:30 pm

Still saying the socket is /tmp?

Has you SQL server ever worked?

The other thing is did you disable the binding as mentioned in the other thread on the wxforums.

There are a number of factors that are not setup correctly on your mysql server.

I will list each one and you can check later. Just grabbing a bite to eat.

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Wed Feb 06, 2019 8:48 pm

Simon, I can connect and make changes to the MySQL database thru both the terminal and a GUI client and I've disabled the binding in my.sql. Here are the connection parameters from the GUI client:

Address: localhost:3306
Database: meteobridge
URL: jdbc:mysql://localhost:3306/meteobridge
Server: MySQL[5.7.25-0ubuntu0.18.04.2

Think I'll grab a bite too.

BTW-I installed phpmyadmin and both http://localhost/phpmyadmin/setup/index.php and http://192.168.1.4/phpmyadmin/setup/index.php return a '404 Not Found' error.

User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Wed Feb 06, 2019 9:53 pm

phpMyAdmin usually sits under the web folder of your apache server. not just in it own folder as it is web based and requires a webserver to work.

anyway.

just confirm the following on your sql server:

so you need to enable remote access on the mysql server (default port 3306)

now stop mysql daemon/service.

its conf it usually here: /etc/mysql/my.cnf yours maybe else where.

Code: Select all

find / -name  mysql.cnf
then edit the file and look for Bind address entry in that file it is probably something like

Code: Select all

bind-address = 127.0.0.1
just comment it out with a #

Code: Select all

# bind-address = 127.0.0.1


that allows remote sessions to the server "from" another network device. port should be 3306

check for [mysqld] area: not the [client] area find and make sure

/socket = /tmp/mysql.sock

then save. and restart mysql server.

in meteobridge you wont use localhost. localhost would mean the meteobridge device. you must now use the ip address of the mysql server.

username can still be larry with the password.

the other issues is

SHOW GRANTS FOR CURRENT_USER;

GRANT USAGE ON *.* TO 'larry'@'localhost'
GRANT ALL PRIVILEGES ON `meteobridge`.* TO 'larry'@'localhost'

larry has access via localhost and NOT larry@<meteobridge ip>

so you need to grant permissions to user larry@192.168.1.79 to the meteobridge database.

GRANT ALL PRIVILEGES ON * . * TO 'larry'@'192.168.1.79';

then hopefully it will work.

failing this, I have no clue, it should not be as hard as it is to setup a remote session to a database. honestly.

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Wed Feb 06, 2019 10:35 pm

check for [mysqld] area: not the [client] area find and make sure

/socket = /tmp/mysql.sock
Simon, I've checked everything and the only difference I can see is:

[mysqld]
socket = /tmp/mysqld.sock

Also, when I create a user in the terminal, it is always created as @localhost even is I specify @192.168.1.79

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Thu Feb 07, 2019 12:09 am


User avatar
ConligWX
Expert Boarder
Expert Boarder
Posts: 136
Joined: Wed Nov 14, 2018 12:48 pm
Location: Conlig, Co. Down, UK
Contact:

Re: Meteobridge MySQL service returns socket error

Post by ConligWX » Thu Feb 07, 2019 12:27 am

can you post the command line you are putting into meteobridge mysql query field?

its obviously a wrong format or something.

1st:

INSERT INTO 'meteobridge' ....

should be

INSERT INTO meteobridge .... without the quotes around the database name.

we still need the rest of the query line. put it in a code bracket.

Boris corrected a few issues with this user: viewtopic.php?f=61&t=13583&p=27776

Larry29936
Fresh Boarder
Fresh Boarder
Posts: 13
Joined: Thu Jul 16, 2015 1:11 am

Re: Meteobridge MySQL service returns socket error

Post by Larry29936 » Thu Feb 07, 2019 1:22 am

Simon, Here's the insert statement:

Code: Select all

INSERT INTO mystation (ID, DateTime, TempOutCur, HumOutCur, PressCur, DewCur, HeatIdxCur, WindChillCur, TempInCur, HumInCur, WindSpeedCur, WindAvgSpeedCur, WindDirCur, WindDirCurEng, WindGust10, WindDirAvg10, WindDirAvg10Eng, RainRateCur, RainDay, RainYest, RainMonth, RainYear) VALUES (NULL, [YYYY]-[MM]-[DD] [hh]:[mm]:[ss], [th0temp-act=F], [th0hum-act], [thb0seapress-act=inHg.2], [th0dew-act=F], [th0heatindex-act=F], [wind0chill-act=F], [thb0temp-act=F], [thb0hum-act], [wind0wind-act=mph], [wind0avgwind-act=mph], [wind0dir-act], [wind0dir-act=endir], [wind0wind-max10=mph], [wind0dir-avg10], [wind0dir-avg10=endir], [rain0rate-act=in.2], [rain0total-daysum=in.2], [rain0total-ydaysum=in.2], [rain0total-monthsum=in.2], [rain0total-yearsum=in.2])
I fixed it by enclosing the values in apostrophes. All working fine now.

Thanks for your patience and assistance.

Larry

Post Reply