2

I have a WAMP server with the following credentials for the MySQL:

username: root
password: ''

But when I configure the $autoload['libraries'] = array('database');, I get this error:

A PHP Error was encountered

Severity: Warning

Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: NO)

Filename: mysqli/mysqli_driver.php

Line Number: 202

Backtrace:

File: C:\wamp\www\ci\index.php
Line: 315
Function: require_once

A Database Error Occurred

Unable to connect to your database server using the provided settings.

Filename: C:/wamp/www/ci/system/database/DB_driver.php

Line Number: 436

If I'm not mistaken, it is asking for a password in MySQL to which I did not put one. Below is the configuration at Codeigniter's database.php.

$active_group = 'default';
$query_builder = TRUE;

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root',
    'password' => '',
    'database' => 'sandbox',
    '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

Thank you for the help.

Ibanez1408
  • 4,550
  • 10
  • 59
  • 110
  • Change 'password' => '', to 'password' => null and try again – Mayank Pandeyz Aug 09 '16 at 04:42
  • The error changed to: Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) – Ibanez1408 Aug 09 '16 at 04:48
  • Check [here](http://stackoverflow.com/questions/20353402/access-denied-for-user-testlocalhost-using-password-yes-except-root-user). – Tpojka Aug 09 '16 at 05:57

0 Answers0