mysql - MySQLi access denied from php -
when try connect mysqli inside php following error:
warning: mysqli::__construct(): (hy000/1045): access denied user 'root'@'localhost' (using password: yes) in xxxxxxxx
connect error (1045) access denied user 'root'@'localhost' (using password: yes)
however can login exact same credentials phpmyadmin , using mysql console.
i have granted root@localhost permissions.
here testfile use connect database:
<?php $mysqli = new mysqli('localhost', 'root', 'rootpassword', 'mydatabase'); if ($mysqli->connect_error) { die('connect error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error ); } echo 'connection ok'; $mysqli->close(); ?>
what should fix this?
update:
here new code:
$mysqli = new mysqli('localhost', 'root', 'root', 'ignis', '3307'); if ($mysqli->connect_error) { die('connect error (' . $mysqli->connect_errno . ') ' . $mysqli->connect_error ); } echo 'connection ok'; $mysqli->close();
with connection ok, when try connect using 'joomla' way of connecting database still error
error displaying error page: application instantiation error: not connect mysql.
anyone has idea of how fix this?
here part of configuration.php file used connect database:
public $dbtype = 'mysqli'; public $host = 'localhost:3307'; //tried using :59420 no success either have configured //to port 3307 in wamp idk how mysql console ever came port 59420. public $user = 'root'; public $password = 'root'; public $db = 'ignis'; public $dbprefix = 'igns_';
result of show processlist
+----+------+-----------------+------+---------+------+----------+------------------+ | id | user | host | db | command | time | state | info | +----+------+-----------------+------+---------+------+----------+------------------+ | 85 | root | localhost:59420 | null | query | 0 | starting | show processlist | +----+------+-----------------+------+---------+------+----------+------------------+
after full day have figured out,
joomla being weird file used, prefered configurations.php.txt inside joomla folder above configurations.php in site root.
why?
because in factory.php file there piece of code:
public static function getconfig($file = null, $type = 'php', $namespace = '') { if (!self::$config) { if ($file === null) { $file = jpath_configuration . '/configuration.php.txt'; } self::$config = self::createconfig($file, $type, $namespace); } return self::$config; }
where jpath_configuration = jpath_root
(the joomla folder) , /configuration.php.txt
hardcoded ignored /configurations.php file.
but still don't why did mysql break after windows update? because there update had blocking connections without specified ports? worked before windows update.
Comments
Post a Comment