# How to access MariaDB remotely?

**URL:** https://forums.vitalpbx.org/t/how-to-access-mariadb-remotely/2560
**Category:** FAQ
**Created:** [March 27, 2023, 12:20pm UTC](https://forums.vitalpbx.org/t/how-to-access-mariadb-remotely/2560 "2023-03-27T12:20:02Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![admin](https://forums.vitalpbx.org/user_avatar/forums.vitalpbx.org/admin/32/3_2.png) [@admin](https://forums.vitalpbx.org/u/admin)
#### Post date: [March 27, 2023, 12:20pm UTC](https://forums.vitalpbx.org/t/how-to-access-mariadb-remotely/2560/1 "2023-03-27T12:20:02Z")

</div>

We do not recommend creating an external shortcut to the database for security. But if you know what you’re doing, you’ll know your own risks.

In order to remotely access MySQL (MariaDB) in VitalPBX you must follow the following steps.

1. Make sure that port 3306 is not blocked in your firewall
2. Create the Service in the VitalPBX Firewall (Admin/Firewall/Services) with port 3306
3. Create the Rule (Admin/Firewall/Rules) to use the previously created Service.
4. Go to your server console and modify the 50-server.cnf file.

```auto
nano /etc/mysql/mariadb.conf.d/50-server.cnf

```

Change:

```auto
bind-address = 127.0.0.1

```

to

```auto
bind-address = 0.0.0.0

```

Finally, restart MariaDB.

```auto
sudo systemctl restart mariadb

```

1. And last but not least, configure the DB credentials to access remotely.

```auto
mysql -uroot

```

```auto
MariaDB [(none)]> GRANT ALL PRIVILEGES ON *.* TO USERNAME@'YOUR_PUBLIC_IP' IDENTIFIED BY 'PASSWORD';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit

```

**Note:**

> With \*.\* you can access all databases. If you only want the CDR database you must write asterisk.\*
