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.

3
  • Change 'password' => '', to 'password' => null and try again Commented Aug 9, 2016 at 4:42
  • The error changed to: Message: mysqli::real_connect(): (HY000/1045): Access denied for user 'root'@'localhost' (using password: YES) Commented Aug 9, 2016 at 4:48
  • Check here. Commented Aug 9, 2016 at 5:57

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.