Connecting to Mariadb server on another computer

I have MariaDB running on a Raspberry Pi (192.168.1.11) and I can access it from Node-red on that Pi, using node-red-node-mysql.

In /etc/mysql/mariadb.conf.d/50-server.cnf I have bind-address = 0.0.0.0
netstat -ant | grep 3306 confirms that MariaDB is listening to all IP addresses
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN

When I try to access the db from Node-red on another Pi (192.168.1.26) I get the error

Error: Host '192.168.1.26' is not allowed to connect to this MariaDB server.

Any suggestions what else I can do to enable access?

node-red on 192.168.1.26 is 2.2.2, on 192.168.1.11 2.2.0
node-red-node-mysql 1.0.0
mariadb version: 10.3.31-MariaDB-0+deb10u1 Raspbian 10

You need to look at the mariadb docs for granting permission to users. Databases normally grant access based on a username, password and the IP of the connecting client.

It sounds like you have only granted access to the user if they are on the same host as the db

Ok thanks @hardillb. I'll look into user@address when I get back to the computer.
Both devices are running NR as user pi.

What OS user is running Node-RED or the Database is irrelevant, the database has it's own users and permissions.

A hint that might help is you can use the SQL wildcard character % to signify any remote IP address.

Thanks for the advice. Yes, I had to grant privileges in the database as well as listening to all IPs:

sudo mysql -u root -p
grant all privileges on *.* to 'pi'@'192.168.1.26' identified by 'password1' with grant option;

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.