I tried both the cli and the /public install page to install SuiteCRM 8 on my local environment. I am using MAMP on a Mac to install this. It gives me an error that says âDatabase Connection Error: The provided database hostname, port, username, and/or password is invalid.â.
The problem with this is, I have several other sites (as well as SuiteCRM 7) running just fine with the same exact connection parameters. I even copied and pasted and double checked the info from the config file of the other suite7 install that is working fine.
Is there anything else I can do here? Log files donât seem to be of much help. Thanks!
I have the same problem. Exactly with the same parameters I installed version 7.11 and 8 RC (a few days ago and they worked). For version 8.0 this problem has occurred. And I canât connect to the base on installation.
Adding IP 127.0.0.1 and localhost as allowed hosts to access the dbase not working in my case.
I would say the database connection issue with SuiteCRM8.0 could have several issues, in my setup the connection was not working with PHP 7.4, but working with PHP8.0, therefore I would say it might be in the mysql module used by PHP ?
Iâve checked the changes done from RC to 8.0. And the only change on the checkDBConnection step, was a change to provide the port (which allows setting a custom port).
As you can see from the log messages PDO is not being able to access the db
[2021-11-24 10:47:36] install.INFO: Running step: check-db-connection [] []
[2021-11-24 10:47:36] app.ERROR: An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2005] Unknown MySQL server host â127.0.0.1:â (-2) [] []
...
[2021-11-24 10:47:59] install.INFO: Running step: check-db-connection [] []
[2021-11-24 10:47:59] app.ERROR: An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2005] Unknown MySQL server host â127.0.0.1:3306â (-2) [] []
Some other questions to try to debug the problem:
Are you using CentOS? do you have selinux enabled? It has some options to block the db connections.
[2021-11-24 10:47:30] app.ERROR: An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2005] Unknown MySQL server host âlocalhost:â (-2) [] []
PHP 7.4
DB port 3306
I dont now CentOS selinux
this server is a shared service
It is working:
s84 ~ # telnet localhost 3306
Trying ::1âŚ
Connected to localhost.
Escape character is â^]â.
a
5.5.5-10.3.31-MariaDB-cll-lve
Where is that line of code with the port maybe just remove the â:â
I tried that too, of course. It doesnât work either
[2021-11-23 18:16:38] app.ERROR: An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2005] Unknown MySQL server host âlocalhost:3306â (-2) [] []
If you are comfortable with changing the code, please? could you try replacing the checkDBConnection method in core/backend/Install/LegacyHandler/InstallHandler.php, with:
public function checkDBConnection(array $inputArray): bool
{
$host = "mysql:host=" . $inputArray["db_host"];
if (!empty($inputArray["db_port"])) {
$host .= ":" . $inputArray["db_port"];
}
try {
new PDO(
$host . ";",
$inputArray['db_username'],
$inputArray['db_password']
);
} catch (PDOException $e) {
$this->logger->error('An error occurred while checking the Database Host Connection ' . $e->getMessage());
return false;
}
return true;
}