Page 1 of 2

Meteobridge MySQL service returns socket error **solved**

Posted: Tue Feb 05, 2019 3:03 am
by Larry29936
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

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 3:53 pm
by ConligWX
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?

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 4:23 pm
by ConligWX
failing this, you could try and uninstall mysql and instead use MariaDB. unless your using the db for other applications i guess.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 5:19 pm
by Larry29936
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.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 5:22 pm
by ConligWX
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.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 5:26 pm
by Larry29936
So, I should stop the service, move the .sock file to the /tmp folder, and edit mysql.cnf and my.cnf?

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 5:33 pm
by ConligWX
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

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 5:58 pm
by Larry29936
Same error after editing my.sql and and restarting mysql.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 8:30 pm
by ConligWX
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.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 8:48 pm
by Larry29936
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.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 9:53 pm
by ConligWX
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.

Re: Meteobridge MySQL service returns socket error

Posted: Wed Feb 06, 2019 10:35 pm
by Larry29936
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

Re: Meteobridge MySQL service returns socket error

Posted: Thu Feb 07, 2019 12:09 am
by Larry29936

Re: Meteobridge MySQL service returns socket error

Posted: Thu Feb 07, 2019 12:27 am
by ConligWX
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

Re: Meteobridge MySQL service returns socket error

Posted: Thu Feb 07, 2019 1:22 am
by Larry29936
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