feature: support non-standard unix socket (#5724)

* Add support for custom MySQL unix-socket

* NULL must be lowercase!

* Naive edit of html/install.php

* fixup

* Refactor dbConnect
Use it everywhere

* $config needs to be global
Don't need to set $database_link

* small cleanups
This commit is contained in:
Tony Murray
2017-04-06 16:02:37 -05:00
committed by Neil Lathwood
parent 66d9d54f73
commit b1a414e785
15 changed files with 196 additions and 129 deletions

View File

@@ -158,12 +158,14 @@ if (isset($config['user'])) {
}
// Run test on MySQL
$test_db = @mysqli_connect($config['db_host'], $config['db_user'], $config['db_pass'], $config['db_name'], $config['db_port']);
if (mysqli_connect_error()) {
print_fail('Error connecting to your database '.mysqli_connect_error());
} else {
try {
dbConnect();
print_ok('Database connection successful');
} catch (\LibreNMS\Exceptions\DatabaseConnectException $e) {
print_fail('Error connecting to your database '.$e->getMessage());
}
// pull in the database config settings
mergedb();
// Test for MySQL Strict mode
$strict_mode = dbFetchCell("SELECT @@global.sql_mode");