Closed Lycol50 closed 2 years ago
up
This shouldn't be needed, you can just add the port to the end of the host.
This shouldn't be needed, you can just add the port to the end of the host.
A Snippet from libasynql/MysqlCredentials.php
, it defaults itself to port 3306, when $array["port"]
is NULL
/**
* Creates a new {@link MysqlCredentials} instance from an array (e.g. from Config), with the following defaults:
* <pre>
* host: 127.0.0.1
* username: root
* password: ""
* schema: {$defaultSchema}
* port: 3306
* socket: ""
* </pre>
*
* @param array $array
* @param string|null $defaultSchema default null
* @return MysqlCredentials
* @throws ConfigException If <code>schema</code> is missing and <code>$defaultSchema</code> is null/not passed
*/
public static function fromArray(array $array, ?string $defaultSchema = null) : MysqlCredentials{
if(!isset($defaultSchema, $array["schema"])){
throw new ConfigException("The attribute \"schema\" is missing in the MySQL settings");
}
return new MysqlCredentials($array["host"] ?? "127.0.0.1", $array["username"] ?? "root",
$array["password"] ?? "", $array["schema"] ?? $defaultSchema, $array["port"] ?? 3306, $array["socket"] ?? "");
}
Assuming 2151 is your port number, Therefore, using X.X.X.X:2151 will not work, because without port parameter on config, it defaults itself to 3306.
its is supported, by libasynql without modifying src files.