NeDi Community

NeDi Software Specific => Database => Topic started by: janet on September 25, 2020, 11:44:03 am

Title: NeDI 1.9 - is there a way to point to a custom MySQL socket file?
Post by: janet on September 25, 2020, 11:44:03 am
I tried setting dbhost to the path to my socket, but it didn't work.  Is there a way to use a socket?
Title: Re: NeDI 1.9 - is there a way to point to a custom MySQL socket file?
Post by: rickli on October 07, 2020, 10:22:17 am
I haven't considered this scenario yet. How are you running this?
Title: NeDI 1.9 - Custom Port?
Post by: janet on October 11, 2020, 09:22:47 am
Well, I was trying to work around a problem I had with NeDi and my mariadb.  Our security folk won't let us run databases on default ports or sockets.  While I can define dbhost like this:

dbhost      127.0.0.1:3402

Only nedi.pl works.  The web GUI doesn't.  Really, all I want is the ability to do this in the config:

dbhost      127.0.0.1
dbport      3402
cactihost  127.0.0.1
cactiport   3402

Right now I use 127.0.0.1:3402 for dbhost and cactihost, and hacked /html/inc/libdb-mysql.php.  That said, my solution is ugly - I don't know php, so I just did this:

function DbConnect($host,$user,$pass,$db){
        $host = '127.0.0.1';
        $port = 3402;
        $l = mysqli_connect($host,$user,$pass,$db,$port) or die("Could not connect to $db@$host $port with $user");
        mysqli_set_charset($l, "utf8");                                                                 # Some stubborn servers need this, tx Nils
        return $l;
}

It works, but its an ugly hard coded hack. 
Title: Re: NeDI 1.9 - is there a way to point to a custom MySQL socket file?
Post by: rickli on October 12, 2020, 12:12:01 pm
As long as it works :-) I'll add support for this and packport to NeDi 2.0 Patch3...