SQLSTATE[HY000] [1045] Access denied for user


unable to load in hosting Fatal error: Uncaught exception 'ActiveRecord\DatabaseException' with message 'exception 'PDOException' with message 'SQLSTATE[HY000] [1045] Access denied for user

fix with this trick to set

-- database.php
<?php

defined('BASEPATH') OR defined('FCPATH') OR exit('No direct script access allowed');

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

$db['default'] = array(
    'dsn'   => 'mysql://user:pass@localhost/dbname',
    'hostname' => 'localhost',
    'username' => 'user',
    'password' => 'pass',
    'database' => 'dbname',
    'dbdriver' => 'pdo',
    'dbprefix' => '',


-- vendor\php-activerecord\php-activerecord\lib\Connection.php
line 235 - 253
protected function __construct($info)
{
try {
// unix sockets start with a /
if ($info->host[0] != '/')
{
$host = "host=$info->host";

if (isset($info->port))
$host .= ";port=$info->port";
}
else
$host = "unix_socket=$info->host";

$this->connection = new PDO("$info->protocol:$host;dbname=$info->db", $info->user, $info->pass, static::$PDO_OPTIONS);
} catch (PDOException $e) {
throw new DatabaseException($e);
}
}
Monetize your website traffic with US
Monetize your website traffic with Me

0 Response to "SQLSTATE[HY000] [1045] Access denied for user"

Post a Comment

Archive

Populer