Welcome Guest, Not a member yet? Register   Sign In
Testing
#1
Bug 

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]
Reply
#2

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 )
Reply




Theme © iAndrew 2016 - Forum software by © MyBB