The connection to the database of the site?

In General, I have a dump site. Filled with a host, come on in and see the message
Warning: mysqli_connect(): (28000/1045): Access denied for user 'admin_magaz'@'localhost' (using password: YES) in /home/admin/web/max4i185.vds/public_html/lib/class_db.php on line 83

Created a database root with the name of the mag is filled to the table from the file
Look configs of a site, there is a file config.ini.php in which I wrote
<?php 
 /** 
 * Configuration

 * @package Digital Downloads Pro
 * @author wojoscripts.com
 * @copyright 2011
 * @version Id: config.ini.php v2.00 2011-04-20 10:12:05 gewa Exp $
*/

 if (!defined("_VALID_PHP")) 
 die('Direct access to this location is not allowed.');

 /** 
 * Database Constants - these constants refer to 
 * the database configuration settings. 
*/
 define('DB_SERVER', 'localhost'); 
 define('DB_USER', 'root'); 
 define('DB_PASS', '**'); 
 define('DB_DATABASE', 'mag');

 /** 
 * Show MySql Errors. 
 * Not recomended for a live site. true/false 
*/
 define('DEBUG', false);

 /** 
 * Cookie Constants - these are the parameters 
 * to the setcookie function call, change them 
 * if necessary to fit your website 
*/
 define('COOKIE_EXPIRE', 60 * 60 * 24 * 60); 
 define('COOKIE_PATH', '/');
?>

Locally to the base can with the data that is in the configuration to connect everything is OK
mysql-uroot -p
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| admin_default |
| admin_magaz |
| mag |
| mysql |
| performance_schema |
| roundcube |
+--------------------+
7 rows in set (0.00 sec)

And the error remains the same..
Warning: mysqli_connect(): (28000/1045): Access denied for user 'admin_magaz'@'localhost' (using password: YES) in /home/admin/web/max4i185.vds/public_html/lib/class_db.php on line 83

Well rebutnul WDSU completely, all the same.
Look at the file class_db.php
spoiler
<?php
/**
 * Database Class
*
 * @package Digital Downloads Pro
 * @author wojoscripts.com
 * @copyright 2010
 * @version $Id: indexclass_db.php v2.00 2011-07-10 10:12:05 gewa Exp $
*/

 if (!defined("_VALID_PHP"))
 die('Direct access to this location is not allowed.');

 class Database
{
 private $server = "";
 private $user = "";
 private $pass = "";
 private $database = "";
 public $error = "";
 public $errno = 0;
 protected $affected_rows = 0;
 protected $query_counter = 0;
 protected $link_id = 0;
 protected $query_id = 0;
 protected $query_show;


/**
 * Database::__construct()
 * 
 * @param mixed $server
 * @param mixed $user
 * @param mixed $pass
 * @param mixed $database
 * @return
*/
 function __construct($server, $user, $pass, $database)
{
 $this--->server = $server;
 $this->user = $user;
 $this->pass = $pass;
 $this->database = $database;

}

/**
 * Database::connect()
 * Connect and select database using vars above
 * @return
*/
 public function connect()
{
 $this->link_id = $this->connect_db($this->server, $this->user, $this->pass);

 if (!$this->link_id)
 $this->error("<div style="text-align:center">" 
 . "<span style="padding: 5px; border: 1px solid #999; background-color:#EFEFEF;" 
 . "font-family: Verdana; font-size: 11px; margin-left:auto; margin-right:auto">" 
 . "<b>Database Error:</b>Connection to Database " . $this->database . "Failed</span></div>");

 if (!$this->select_db($this->database, $this->link_id))
 $this->error("<div style="text-align:center">" 
 . "<span style="padding: 5px; border: 1px solid #999; background-color: #EFEFEF;" 
 . "font-family: Verdana; font-size: 11px; margin-left:auto; margin-right:auto">" 
 . "<b>Database Error:</b>mySQL database (" . $this->database . ")cannot be used</span></div>");

 mysqli_set_charset($this->link_id, "utf8");

unset($this->password);
}

/**
 * Database::connect_db()
 * 
 * @param mixed $server
 * @param mixed $user
 * @param mixed $pass
 * @return
*/
 private function connect_db($server, $user, $pass)
{
 return mysqli_connect($server, $user, $pass);
}

/**
 * Database::select_db()
 * 
 * @param mixed $database
 * @param mixed $link_id
 * @return
*/
 private function select_db($database, $link_id)
{
 return mysqli_select_db($link_id, $database);
}

/**
 * Database::query()
 * Executes SQL query to an open connection
 * @param mixed $sql
 * @return (query_id)
*/
 public function query($sql)
{
 if (trim($sql != "")) {
$this->query_counter++;
 $this->query_show .= stripslashes($sql) . "<hr size="1">";
 $this->query_id = mysqli_query($this->link_id, $sql);

 $this->last_query = $sql . '<br>';
}

 if (!$this->query_id)
 $this->error("mySQL Error on Query :" . $sql);

 return $this->query_id;

}

/**
 * Database::first()
 * Fetches the first row only, frees resultset
 * @param mixed $string
 * @param bool $type
 * @return array
*/
 public function first($string, $type = false)
{
 $query_id = $this->query($string);
 $record = $this->fetch($query_id, $type);
$this->free($query_id);

 return $record;
}

/**
 * Database::fetch()
 * Fetches and returns results one line at a time
 * @param integer $query_id
 * @param bool $type
 * @return array
*/
 public function fetch($query_id, $type = false)
{
 if ($query_id)
 $this->query_id = $query_id;

 if (isset($this->query_id)) {
 $record = ($type) ? mysqli_fetch_array($this->query_id, MYSQL_ASSOC) : mysqli_fetch_object($this->query_id);
 } else
 $this->error("Invalid query_id: <b>" . $this->query_id . "</b>. Records could not be fetched.");

 return $record;
}

/**
 * Database::fetch_all()
 * Returns all the results
 * @param mixed $sql
 * @param bool $type
 * @return assoc array
*/
 public function fetch_all($sql, $type = false)
{
 $query_id = $this->query($sql);
 $record = array();

 while ($row = $this->fetch($query_id, $type)) :
 $record[] = $row;
endwhile;

$this->free($query_id);

 return $record;
}

/**
 * Database::free()
 * Frees the resultset
 * @param integer $query_id
 * @return query_id
*/
 private function free($query_id)
{
 if ($query_id)
 $this->query_id = $query_id;

 return mysqli_free_result($this->query_id);
}

/**

?>

and nothing is clear, where it takes Access denied for user 'admin_magaz'@'localhost', if explicitly specified in the config root@localhost
p.s. file class_db.php a little cut for the toaster does not give a lot of characters to write)
June 10th 19 at 15:49
2 answers
June 10th 19 at 15:51
Solution
File config.ini.php should be in the folder /lib
And that's what it should be, I XS, not familiar with this CMS
June 10th 19 at 15:53
You have a database user - "admin_magaz". In the config you have "root". Try instead of "root" prescribe "admin_magaz".

Find more questions by tags MySQLWeb DevelopmentPHP