简体   繁体   中英

problem connecting to mysql - Access denied for user 'root'@'localhost' (using password: YES)

A PHP Error was encountered
Severity: Warning

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

Filename: mysqli/mysqli_driver.php

Line Number: 203

Backtrace:

File: C:\\xampp\\htdocs\\ciblog\\application\\models\\Post_model.php Line: 4 Function: database

File: C:\\xampp\\htdocs\\ciblog\\index.php Line: 315 Function: require_once

Edit the database.php file in

application/config/database.php

$db['default'] = array(
    'dsn'   => '',
    'hostname' => 'localhost',
    'username' => 'root', // ADD USERNAME HERE
    'password' => '', // PASSWORD
    'database' => 'database_name', // DATABASE NAME
    'dbdriver' => 'mysqli',
    'dbprefix' => '',
    'pconnect' => TRUE,
    'db_debug' => TRUE,
    'cache_on' => FALSE,
    'cachedir' => '',
    'char_set' => 'utf8',
    'dbcollat' => 'utf8_general_ci',
    'swap_pre' => '',
    'encrypt' => FALSE,
    'compress' => FALSE,
    'stricton' => FALSE,
    'failover' => array()
);

You can find more info here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM