В общем, есть у меня дамп сайта. Залил на хост, захожу и вижу сообщение
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
Создал бд от рута с названием
mag залил туда таблицы с файла
Смотрю конфиги сайта, там лежит файл config.ini.php в котором я написал
<?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 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', '/');
?>
Локально к базе могу с данными которые в конфигу подключиться всё ок
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)
А ошибка остается всё та же..
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
Ну ребутнул вдску полностью, всё так же.
Смотрю файл
class_db.phpspoiler<?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);
}
/**
?>
и ничего не понятно, откуда оно берет
Access denied for user 'admin_magaz'@'localhost', если в конфиге явно указано root@localhost
p.s. файл class_db.php немного обрезал ибо тостер не дает много символов писать)