【问题标题】:problem connecting to mysql - Access denied for user 'root'@'localhost' (using password: YES)连接到 mysql 的问题 - 用户 'root'@'localhost' 的访问被拒绝(使用密码:是)
【发布时间】:2019-09-09 08:16:25
【问题描述】:

遇到 PHP 错误
严重性:Warning

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

文件名:mysqli/mysqli_driver.php

行号: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

【问题讨论】:

  • 请添加更多关于您尝试过的信息。密码正确吗?

标签: php connection


【解决方案1】:

中编辑database.php文件

应用程序/配置/数据库.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()
);

您可以找到更多信息here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-11
    • 2022-11-19
    • 2013-06-11
    • 2013-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-09-10
    相关资源
    最近更新 更多