![]() |
Testing - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Testing (/showthread.php?tid=79893) |
Testing - lukmagg - 08-10-2021 intento hacer testing de mis controladores pero no logro conectar a la base de datos de test me sale ese error: 1) CodeIgniter\TestSliderController::testIndex CodeIgniter\Database\Exceptions\DatabaseException: Unable to connect to the database. Main connection [MySQLi]: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known Esta es mi config en Database.php public $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'mi_base_de_datos', 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => (ENVIRONMENT !== 'production'), 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', 'encrypt' => false, 'compress' => false, 'strictOn' => false, 'failover' => [], 'port' => 3306, ]; public $tests = [ 'DSN' => '', public $default = [ 'DSN' => '', 'hostname' => 'localhost', 'username' => 'root', 'password' => 'root', 'database' => 'test', 'DBDriver' => 'MySQLi', 'DBPrefix' => '', 'pConnect' => false, 'DBDebug' => (ENVIRONMENT !== 'production'), 'charset' => 'utf8', 'DBCollat' => 'utf8_general_ci', 'swapPre' => '', 'encrypt' => false, 'compress' => false, 'strictOn' => false, 'failover' => [], 'port' => 3306, ]; RE: Testing - InsiteFX - 08-10-2021 1) Make sure that you start the MySQLi server. 2) Try changing hostname to 127.0.0.1 If those do not work then your database parameters ar in correct. |