Hi @8153rp,
Thank you for the feedback.
Thats good to know. Do you have mysqli
or mysql
module installed?
What stack are you using?
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:
selinux
enabled? It has some options to block the db connections.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
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! 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”
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”
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.