CI4 + Lando (docker) - Main connection [MySQLi]: No such file or directory |
07-16-2021, 01:05 AM
(This post was last modified: 07-16-2021, 03:31 AM by CCAldo. Edit Reason: Did check connection, and inserted new item )
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?
(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 |
Welcome Guest, Not a member yet? Register Sign In |