Meteobridge MySQL service returns socket error **solved**
Moderator: Mattk
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Meteobridge MySQL service returns socket error **solved**
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
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 (122.08 KiB) Viewed 5033 times
Last edited by Larry29936 on Thu Feb 07, 2019 1:45 am, edited 1 time in total.
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
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?
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.
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
failing this, you could try and uninstall mysql and instead use MariaDB. unless your using the db for other applications i guess.
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
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.
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
it wont allow if the service is running.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.
Last edited by ConligWX on Wed Feb 06, 2019 5:32 pm, edited 2 times in total.
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
So, I should stop the service, move the .sock file to the /tmp folder, and edit mysql.cnf and my.cnf?
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
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.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?
[mysqld]
socket = /tmp/mysql.sock
then restart.
not sure about the mysql.cnf, its usually just one file called my.cnf
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
Same error after editing my.sql and and restarting mysql.
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
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.
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.
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
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.
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.
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
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.
then edit the file and look for Bind address entry in that file it is probably something like
just comment it out with a #
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.
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
Code: Select all
bind-address = 127.0.0.1
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.
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
Simon, I've checked everything and the only difference I can see is:check for [mysqld] area: not the [client] area find and make sure
/socket = /tmp/mysql.sock
[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
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
Finally got the connection solved but not getting any data.
https://www.dropbox.com/s/6aqp5a6ct1tqo ... 9.png?dl=0
https://www.dropbox.com/s/kt1ahoqvh0jm6 ... 4.png?dl=0
https://www.dropbox.com/s/6aqp5a6ct1tqo ... 9.png?dl=0
https://www.dropbox.com/s/kt1ahoqvh0jm6 ... 4.png?dl=0
- ConligWX
- Platinum Boarder
- Posts: 329
- Joined: Wed Nov 14, 2018 12:48 pm
- Location: Conlig, Co. Down, UK
- Contact:
Re: Meteobridge MySQL service returns socket error
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
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
Regards Simon
https://www.conligwx.org/pws
https://www.conligwx.org/pws
-
- Fresh Boarder
- Posts: 13
- Joined: Thu Jul 16, 2015 1:11 am
Re: Meteobridge MySQL service returns socket error
Simon, Here's the insert statement:
I fixed it by enclosing the values in apostrophes. All working fine now.
Thanks for your patience and assistance.
Larry
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])
Thanks for your patience and assistance.
Larry