# Connecting to Mariadb server on another computer

**URL:** <https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764>\
**Category:** General\
**Created:** [21 February 2022 19:11 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764 "2022-02-21T19:11:24Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [21 February 2022 19:11 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764/1 "2022-02-21T19:11:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [21 February 2022 20:10 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764/2 "2022-02-21T20:10:00Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [21 February 2022 20:38 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764/3 "2022-02-21T20:38:55Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![hardillb](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/hardillb/32/12373_2.png) [@hardillb](https://discourse.nodered.org/u/hardillb)\
**Post date:** [21 February 2022 20:50 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764/4 "2022-02-21T20:50:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jbudd](https://avatars.discourse-cdn.com/v4/letter/j/5f8ce5/32.png) [@jbudd](https://discourse.nodered.org/u/jbudd)\
**Post date:** [21 February 2022 21:54 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764/5 "2022-02-21T21:54:17Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [7 March 2022 21:54 UTC](https://discourse.nodered.org/t/connecting-to-mariadb-server-on-another-computer/58764/6 "2022-03-07T21:54:59Z")

</div>

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