How to enable remote connection to MariaDB

I just did a backup and then restore after upgrading my PBX to the newest stable distro, downloaded and used all the defaults PBX Firmware:12.7.6-1904-1.sng7 from System Admin… Current Asterisk Version: 13.22.0 from asterisk info. I did this so it wouldn’t have any of my hacks to get this working or that working… it was be as vanilla as possible. I wanted to make sure I didn’t have any issues because of my lack of knowledge. Linux is not my friend most of the time.

on my old box I had enabled remote connections to mysql for pulling call reports out to flat file and creating some reports for upper management about those calls, so I don’t have to give them access to the GUI and CDR. There is probably a way to do this but that is not the question here.

My question is how do I give remote access to MariaDB? I have looked at a couple of websites and Maria and MySql seem to be almost the same? but the way to grant access to it isn’t working for me! Can someone please tell me how to allow any computer to access the asteriskcdrdb, my query works when I run it from the SSH on the box so my thought is the script that used either doesn’t have access or the mysql driver isn’t working.

#PleaseBeNice :slight_smile:

pretty simple and using the asterisk cdr database as an example …

log in to console locally or via ssh

then enter mysql/mariadb with

~]# mysql

then

MariaDB [(none)]> use mysql;

then create your user and password with the following

MariaDB [mysql]> CREATE USER ‘someuser’@‘%’ IDENTIFIED BY ‘somepassword’;

define from where the resource can connect , we’ll use anywhere

MariaDB [mysql]> grant select on asteriskcdrdb.* TO ‘someuser’@‘%’;

finally apply the new permissions with

MariaDB [mysql]> FLUSH PRIVILEGES;

you can then test with something like mysql workbench

good luck

6 Likes

thanks Chris! worked great!!!

1 Like

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