![]() |
CI4 + Lando (docker) - Main connection [MySQLi]: No such file or directory - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: CI4 + Lando (docker) - Main connection [MySQLi]: No such file or directory (/showthread.php?tid=79660) |
CI4 + Lando (docker) - Main connection [MySQLi]: No such file or directory - CCAldo - 07-16-2021 I'm having some issues setting up CodeIgniter 4 with Lando. CI4 is unable to connect to the MySQL database. Code: "Unable to connect to the database. CI3 has no issues with this matter. Lando uses a lamp database with these settings Code: host: 'database', port: '3306', database: 'lamp', password: 'lamp', user: 'lamp' The CI4 database.php has been changes with this: Code: public $lando = [ ``mysql status`` shows me that UNIX socket is located at this location: Code: /opt/bitnami/mysql/tmp/mysql.sock So I added this line to php.ini Code: ; MySQLi But the issue persist. My docker container: ![]() EDIT: When checking connection with below code the result is 'Connected succesfully'. And inserted new news-item also trows no error Code: // Check connection Does anyone having the same issue? Or is Ci4 not able to work with MySQL in docker containers? RE: CI4 + Lando (docker) - Main connection [MySQLi]: No such file or directory - paulbalandan - 07-16-2021 Try changing the host name to either 'localhost' or '127.0.0.1' RE: CI4 + Lando (docker) - Main connection [MySQLi]: No such file or directory - CCAldo - 07-19-2021 (07-16-2021, 08:28 AM)paulbalandan Wrote: Try changing the host name to either 'localhost' or '127.0.0.1'No solution using 127.0.0.1 Lando makes his own hostname, which defaults to 'database' This does work: PHP Code: <?php But this does not; This is the error message: Unable to connect to the database. Main connection [MySQLi]: Connection refused PHP Code: <?php |