Install database connection issue with SuiteCRM 8

Yes, I can log in.
It looks like it’s working.

Hi @Jurij0123,

Does your env.local have :3306 on DATABASE_URL?

No but have “:”
@localhost:

Hi @Jurij0123,

Many thanks for the feedback. Glad you got it working.

This needs a fix from our side, both on the file you changed and on the file that builds the .env.local.

I’ve already raised this internally.

Hi! This does not work for me. I corrected the code, ran:

# ./bin/console suitecrm:app:install -vvv -u "admin" -p "admin" -U "suitecrm" -P "qwerty" -H "127.0.0.1" -Z "3306" -N "suitecrm" -S "http://localhost/" -d "yes"

but it still says that

ERROR [app] An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2005] Unknown MySQL server host '127.0.0.1:3306' (-2)

Connecting from command line works fine:

mysql -u suitecrm --password='qwerty' -h 127.0.0.1 -P 3306 suitecrm
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 13
Server version: 10.5.11-MariaDB-alt2 (ALT Sisyphus)

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [suitecrm]>

I am running php7-7.4.26

Hi @vomus,

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

After applying the fix, did you try with just localhost?

# ./bin/console suitecrm:app:install -vvv -u "admin" -p "admin" -U "suitecrm" -P "qwerty" -H "localhost" -N "suitecrm" -S "http://localhost/" -d "yes"

Yes. It does not work

[app] An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2005] Unknown MySQL server host 'localhost:3306' (-2)

  public function checkDBConnection(array $inputArray): bool
    {
        try {
            new PDO(
		"mysql:host=" . $inputArray["db_host"] . (empty($inputArray["db_port"]) ? "" : ":" . $inputArray["db_port"]) . ";",
/* баг из из форума https://community.suitecrm.com/t/install-database-connection-issue-with-suitecrm-8/82978/18
 * "mysql:host=" . $inputArray["db_host"] . ":" . $inputArray["db_port"] . ";", 
 */
                $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;
    }

Hi @vomus,

Thanks for the feedback. Just for debugging purposes. Could you try replacing

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

with

"mysql:host=" . $inputArray["db_host"] . ";",

thanks to me it worked!

[root@mez-dir-02 html]# ./bin/console suitecrm:app:install -v -u “admin” -p “admin” -U “suitecrm” -P “qwerty” -H “127.0.0.1” -N “suitecrm” -S “http://localhost/” -d “yes”

SuiteCRM Silent Install

Running: check-install-lock
step: check-install-lock | status: done
Installer not locked. Proceeding with install
Running: check-db-connection
09:02:56 ERROR [app] An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2003] Can’t connect to MySQL server on ‘127.0.0.1:3306’ (111)
step: check-db-connection | status: failed
Could not connect to db

============
[root@mez-dir-02 html]# ./bin/console suitecrm:app:install -v -u “admin” -p “admin” -U “suitecrm” -P “qwerty” -H “localhost” -N “suitecrm” -S “http://localhost/” -d “yes”

SuiteCRM Silent Install

Running: check-install-lock
step: check-install-lock | status: done
Installer not locked. Proceeding with install
Running: check-db-connection
09:03:12 ERROR [app] An error occurred while checking the Database Host Connection SQLSTATE[HY000] [2002] Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ (111)
step: check-db-connection | status: failed
Could not connect to db

============
[root@mez-dir-02 html]#

Doing -H “localhost” -Z “3306” also does not help, it still tries to connect via local socket.

It went through with -H “127.0.0.1” and your correction, I forgot to start mariadb. :slight_smile: But now, when I log in as admin/admin, it says “Error occurred while fetching metadata”.

Hi @vomus,

Glad to hear you were able to do some progress.

The “Error occurred while fetching metadata”., should be due to a different issue.

Could you try the following please?

  • APP_ENV=dev to APP_ENV=qa on .env
  • The open the network on you browser’s dev-tools.
  • try to login.
  • There should be several graphql requests.
  • Check the response, there should be one that has an error entry.
  • This error should have more information about the error and it can help us understand the issue.

Other things to check are:

  • /logs/prod/prod.log
  • /logs/qa/qa.log (if exists)

Thanks but where would I change APP_ENV variable? In which script?

Hi @vomus,

Its on the .env file, should be in the root folder for SuiteCRM 8

Changed from ‘prod’ to ‘qa’, restarted Apache, refreshing http://localhost/public/index.php and see nothing in there. Looking at /logs/, I see qa directory appearing but nothing in it. /logs/prod/prod.log does not showing any new lines (watching with it with ‘tail -f’).

I tried to change from ‘qa’ to ‘dev’ as in your post but got ClassNotFound error:

in /var/www/html/core/backend/Kernel.php (line 84)

  1. public function registerBundles(): iterable
  2. {
  3. $contents = require dirname(__DIR__, 2) . '/config/bundles.php';
  4. foreach ($contents as $class => $envs) {
  5. if ($envs[$this->environment] ?? $envs['all'] ?? false) {
  6. yield new $class();
  7. }
  8. }
  9. }
  10. ``
  11. /**

“Nothing” on the page means empty page. I looked at the code and saw practically nothing in the <body> section.

<body> <app-root></app-root> <script src="[dist/polyfills-es5.bd572d5a52462b4db2e4.js](view-source:http://localhost/public/dist/polyfills-es5.bd572d5a52462b4db2e4.js)" nomodule defer></script><script src="[dist/polyfills-es2015.b81ce80777ba591aef43.js](view-source:http://localhost/public/dist/polyfills-es2015.b81ce80777ba591aef43.js)" type="module"></script><script src="[dist/main-es2015.4f73151df6d41fcd807b.js](view-source:http://localhost/public/dist/main-es2015.4f73151df6d41fcd807b.js)" type="module"></script><script src="[dist/main-es5.4f73151df6d41fcd807b.js](view-source:http://localhost/public/dist/main-es5.4f73151df6d41fcd807b.js)" nomodule defer></script> </body></html>

Hi @vomus

Regarding dev mode. To use it you need to run composer install (as the installable zip only has the prod dependencies), therefore the reason to use qa

And on the network tab (like the following) to you get any requests?

Is there any documentation on ‘composer install’? I am not very good at php… Speaking of the networking in debug

I can only see one 200 OK graphgl request

Hi @vomus,

Regarding the network tab.

After trying to login. Check the api/graphql calls (even the ones with 200 ok). On the response, one should have an error.

You can find the response this way:

If this doesn’t work we will try composer