mysqli::real_connect(): (HY000/1049): Unknown database error in codeigniter

前端 未结 3 2051
天涯浪人
天涯浪人 2021-01-07 04:16

I\'m new to Codeigniter PHP framework. When I\'m testing my application I get \'Unknown database db_name\' error. I have browsed through several sites but didn\'t found solu

3条回答
  •  南笙
    南笙 (楼主)
    2021-01-07 04:41

    I was getting same error when i installed new wampserver 3.2.0, it is an evil it installs MariaDB by default and port 3306 is assigned to it , you cannot even change it. I think codeigniter/php tries to connect to this port by default. I used following , it worked for me i.e. hostname => 'localhost:3308'

     $db['default'] = array(
            'dsn'   => '',
            'hostname' => 'localhost:3308',
            'username' => 'root',
            'password' => '',
            'database' => 'soft',
            'dbdriver' => 'mysqli',
            'dbprefix' => '',
            'pconnect' => FALSE,
            'db_debug' => (ENVIRONMENT !== 'production'),
            'cache_on' => FALSE,
            'cachedir' => '',
            'char_set' => 'utf8',
            'dbcollat' => 'utf8_general_ci',
            'swap_pre' => '',
            'encrypt' => FALSE,
            'compress' => FALSE,
            'stricton' => FALSE,
            'failover' => array(),
            'save_queries' => TRUE
        );
    

提交回复
热议问题