👩‍💻 Check out our latest job positions here 👈 or send us a PM for more info.

Install database connection issue with SuiteCRM 8

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!

Hey,

Try to set 127.0.0.1 instead of localhost

I did try that already. Same error message for some reason.

I had the same issue with a working MySQL user/pass…

I had to add the server IP, 127.0.0.1 and localhost all as allowed hosts to access the dbase and it worked.

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.

Hi @swhitlow,

Thank you for trying out SuiteCRM 8 and for the feedback.

@maxonss thanks for the input!

Other users using MAMP Pro are having the same issue.

I think MAMP it sometimes is related with the “Allow local access only” opion.

The following may help:

Similar questions from the community:

Hi @rasel,

Thank you for trying out SuiteCRM 8 and thanks for the feedback.

Good to know you were able to overcome the problem.

Hi @Jurij0123,

Welcome to the community! :wave: and thanks for trying out SuiteCRM 8.

Could you please check the following logs to see if you get any information that would help debug the problem, please?

  • public/legacy/suitecrm.log
  • logs/prod/prod.log (or dev if you have the mode set to dev

Another question are you also using MAMP pro?

I dont use MAMP
I use Linux
public/legacy/suitecrm.log i s empty

Paert of logs/prod/prod.log
[2021-11-24 10:47:36] request.INFO: Matched route “api_graphql_entrypoint”. {“route”:“api_graphql_entrypoint”,“route_parameters”:{"_route":“api_graphql_entrypoint”,"_controller":“api_platform.graphql.action.entrypoint”,"_graphql":true},“request_uri”:“http://hekko24.pl/public/api/graphql",“method”:"POST”} []
[2021-11-24 10:47:36] security.DEBUG: Checking for guard authentication credentials. {“firewall_key”:“main”,“authenticators”:1} []
[2021-11-24 10:47:36] security.DEBUG: Checking support on guard authenticator. {“firewall_key”:“main”,“authenticator”:“App\Security\LoginFormAuthenticator”} []
[2021-11-24 10:47:36] security.DEBUG: Guard authenticator does not support the request. {“firewall_key”:“main”,“authenticator”:“App\Security\LoginFormAuthenticator”} []
[2021-11-24 10:47:36] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2021-11-24 10:47:36] install.INFO: Running step: check-install-lock [] []
[2021-11-24 10:47:36] install.INFO: step: check-install-lock | status: done [] []
[2021-11-24 10:47:36] install.INFO: step: check-install-lock | messages: [] []
[2021-11-24 10:47:36] install.INFO: Installer not locked. Proceeding with install [] []
[2021-11-24 10:47:36] install.INFO: step: check-install-lock | debug: no debug info [] []
[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:36] install.INFO: step: check-db-connection | status: failed [] []
[2021-11-24 10:47:36] install.INFO: step: check-db-connection | messages: [] []
[2021-11-24 10:47:36] install.INFO: Could not connect to db [] []
[2021-11-24 10:47:36] install.INFO: step: check-db-connection | debug: no debug info [] []
[2021-11-24 10:47:59] request.INFO: Matched route “api_graphql_entrypoint”. {“route”:“api_graphql_entrypoint”,“route_parameters”:{"_route":“api_graphql_entrypoint”,"_controller":“api_platform.graphql.action.entrypoint”,"_graphql":true},“request_uri”:“http://hekko24.pl/public/api/graphql",“method”:"POST”} []
[2021-11-24 10:47:59] security.DEBUG: Checking for guard authentication credentials. {“firewall_key”:“main”,“authenticators”:1} []
[2021-11-24 10:47:59] security.DEBUG: Checking support on guard authenticator. {“firewall_key”:“main”,“authenticator”:“App\Security\LoginFormAuthenticator”} []
[2021-11-24 10:47:59] security.DEBUG: Guard authenticator does not support the request. {“firewall_key”:“main”,“authenticator”:“App\Security\LoginFormAuthenticator”} []
[2021-11-24 10:47:59] security.INFO: Populated the TokenStorage with an anonymous Token. [] []
[2021-11-24 10:47:59] install.INFO: Running step: check-install-lock [] []
[2021-11-24 10:47:59] install.INFO: step: check-install-lock | status: done [] []
[2021-11-24 10:47:59] install.INFO: step: check-install-lock | messages: [] []
[2021-11-24 10:47:59] install.INFO: Installer not locked. Proceeding with install [] []
[2021-11-24 10:47:59] install.INFO: step: check-install-lock | debug: no debug info [] []
[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) [] []
[2021-11-24 10:47:59] install.INFO: step: check-db-connection | status: failed [] []
[2021-11-24 10:47:59] install.INFO: step: check-db-connection | messages: [] []
[2021-11-24 10:47:59] install.INFO: Could not connect to db [] []
[2021-11-24 10:47:59] install.INFO: step: check-db-connection | debug: no debug info [] []

Hi @Jurij0123,

Thanks for the feedback.

Some other questions to try to debug the issue:

  • Are you using docker? or is it a native install?
  • Do you have mysqli and pdo-mysql php extensions installed?

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 ?

Hi @8153rp,

Thank you for the feedback.

Thats good to know. Do you have mysqli or mysql module installed?
What stack are you using?

Native install.
Yes, i have mysqli and pdo-mysql.

Hi @Jurij0123,

Thanks for the feedback.

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.
  • What php version are you using?
  • Is your db on port 3306?

localhost also a problem with":"

[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 “:”

Hi @Jurij0123,

Thank you, I think I get what the problem is now.

Could you try running the command with -Z "3306" please? and using localhost for the db host please?

I think we need to add a fix for that : to check if the port is set or not.

If the the -Z option doesn’t work you can try changing the code in
core/backend/Install/LegacyHandler/InstallHandler.php
method checkDBConnection

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) [] []

Hi @Jurij0123,

Thank you.

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;
    }

Thx clemente.raposo
I just did a simple fix and it works :

core/backend/Install/LegacyHandler/InstallHandler.php
line 265

from:

“mysql:host=” . $inputArray[“db_host”] . “:” . $inputArray[“db_port”] . “;”,

to:

“mysql:host=” . $inputArray[“db_host”] . (empty($inputArray[“db_port”]) ? “” : “:” . $inputArray[“db_port”]) . “;”,

Hi @Jurij0123,

Nice! Could you please let me know if you are able to login ok?

I think there may also be the same problem in the creation of the .env file, that one is going to add the 3306