Could not connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES)
<p>im trying to code a simple login in php+mysql. Everytime i hit submit button i get this error</p>

<blockquote>
  <p>Could not connect to MySQL: Access denied for user 'root'@'localhost' (using password: YES)</p>
</blockquote>

<p>This is code that im using to connect to mysql:</p>

<pre><code>&lt;?php
// Create a connection to the logindb database and to MySQL.
// Set the encoding and the access details as constants:
DEFINE ('DB_USER', 'johny');
DEFINE ('DB_PASSWORD', 'some_pass');
DEFINE ('DB_HOST', 'localhost');
DEFINE ('DB_NAME', 'biblioteczka');
// Make the connection:
$dbcon = @mysqli_connect(DB_HOST,DB_USER,DB_PASSWORD,DB_NAME)
OR die ('Could not connect to MySQL: ' . mysqli_connect_error() );

$ID = $_POST['user'];
$PASSWORD = $_POST['pass'];   
// Set the encoding...
mysqli_set_charset($dbcon, 'utf8');    
function SignIn(){
    session_start();
    if(!empty($_POST['user'])){
        $query = mysql_query("SELECT * FROM userName where user ='$_POST[user]' and pass = '$_POST[pass]'" 
                or die(mysql_error));
        $row = mysql_fetch_array($query) or die(mysql_error());
        if(!empty($row['userName']) AND !empty($row['pass'])){
            $_SESSION['userName'] = $row['pass'];
            echo "SUCCESSFULLY LOGIN TO USER PROFILE PAGE...";
        } else {
            echo "SORRY... YOU ENTERD WRONG ID AND PASSWORD... PLEASE RETRY...";
        }

    }
}
if(isset($_POST['submit']))
{
    SignIn();
}
?&gt;
</code></pre>

<p>I have 2 accounts root and johny, they have all priviliges and i set the passwords and i can work on database that i created.</p>

<p>phpmyadmin config:</p>

<p><a href="https://i.stack.imgur.com/dcjED.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dcjED.jpg" alt="phpmyadmin config"></a></p>

<p>I don't know where's the problem at this points that's why im asking for help.</p>

<p>Sorry for my english i'm not a native speaker</p>