0
votes

I have a client logging device on a RPi trying to connect to a MySQL server on another RPi (192.168.2.204) and failing:

pi@RPi0w-Logger:~ $ sudo python envirologremote.py Traceback (most recent call last): File "envirologremote.py", line 7, in conn=MySQLdb.connect(host="192.168.2.204",user="jim",passwd="xxxxxxxxx",db="EnviroLogger") File "/usr/lib/python2.7/dist-packages/MySQLdb/init.py", line 81, in Connect return Connection(*args, **kwargs) File "/usr/lib/python2.7/dist-packages/MySQLdb/connections.py", line 187, in init super(Connection, self).init(*args, **kwargs2) _mysql_exceptions.OperationalError: (2003, "Can't connect to MySQL server on '192.168.2.204' (111)")

I can connect to the server using PHPMySQL using the same creds, so the server is working and available.

I can connect to a server running locally on the client RPi.

I've been reading various articles on the subject. They seem to home in on a binding option, but they're all over the place on the location and name of the configuration file. I've made sure anywhere I could find a configuration file that it says "bind=0.0.0.0", but nothing changes, even after I reboot.

Here are the user privs: enter image description here

How do I troubleshoot this?

2
Is PHPMySQL running on the same server as the mysql server or on the same server you try to connect from with python. You need to explicitely grant permissions to a user to connect from a remote host. So additinoally to jim@localhost you also need to grant permissions for jim@remotehostderpirscher
Server is on IP address ....204, client is running on IP address ....203. Although 203 has a running MySQL server, it's not the server I'm connecting to. See updated question showing privs by user....(on ....204)JimS-CLT
Privileges seem fine. Firewall allows to connect to port 3306 from a remotehost? Or maybe this helps serverfault.com/questions/171655/… TL;DR: disable bind-address and disable skip-networkingderpirscher

2 Answers

0
votes
mysql> grant all privileges on *.* to 'root'@'%' identified by 'root_password'; 

mysql> flush privileges;

replace ‘%’ to the IP you want to grant access for!

u need to provide privileges hope this work

0
votes

After a dozen tries, I finally found a configuration file with the "bind=127.0.0.1" statement on the 204 instance of MySQL. I had to learn some Linux Bash (grep....) to find it, but I found it in the MariaDB configuration file.

Thanks, I can now get the job done. I appreciate all your help!