Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

fix(install) Get the ip address of an existing connection to set the permission correctly #7347

Merged
merged 4 commits into from
Apr 3, 2019
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion www/install/steps/process/createDbUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,12 @@
$host = "localhost";
// if database server is not on localhost...
if ($parameters['address'] != "127.0.0.1" && $parameters['address'] != "localhost") {
$host = $_SERVER['SERVER_ADDR'];
$getIpQuery = $link->prepare(
'select host from information_schema.processlist WHERE ID=connection_id()'
lgcosta marked this conversation as resolved.
Show resolved Hide resolved
);
$getIpQuery->execute();
// The result example (172.17.0.1:38216), use the explode function to remove port
$host = explode(":", $getIpQuery->fetchAll(PDO::FETCH_COLUMN)[0])[0];
}
$query = "GRANT ALL PRIVILEGES ON `%s`.* TO `" . $dbUser . "`@`" . $host .
"` IDENTIFIED BY '" . $dbPass . "' WITH GRANT OPTION";
Expand Down