-
lukmagg Newbie

-
Posts: 6
Threads: 6
Joined: Oct 2020
Reputation:
0
08-10-2021, 06:37 AM
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' => '',
[font=Menlo, Monaco, 'Courier New', monospace]public $default = [
'DSN' => '',
'hostname' => '[font=Menlo, Monaco, 'Courier New', monospace]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,
];
[/font][/font]
-
InsiteFX Super Moderator
     
-
Posts: 5,336
Threads: 145
Joined: Oct 2014
Reputation:
155
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.
What did you Try? What did you Get? What did you Expect?
Joined CodeIgniter Community 2009. ( Skype: insitfx )
|