title: MySQL Access denied for user 'admin'@'localhost' (using password: YES)
body: <p>Yeah I know this is a common question. But I tried everything and I can't get this solved.</p>
  
  <p>So I am using plesk 12.5 and I can login to mysql from terminal with this script which uses the hashed password:</p>
  
  <pre><code>MYSQL_PWD=`cat /etc/psa/.psa.shadow` mysql -u admin
  </code></pre>
  
  <p>I can even login when I add -h localhost to it.
  But I cannot login when I login from a php script.</p>
  
  <pre><code>&lt;?php
  $mysqli = new mysqli("localhost/ip adress", "admin", "plesk encrypted password", "database");
  
  if (mysqli_connect_errno())
  {
      echo "Failed to connect to MySQL: " . mysqli_connect_error();
  }
  </code></pre>
  
  <p>What I have tried:</p>
  
  <ul>
  <li>I tried to change the password in mysql</li>
  <li>I have tried to update mysql (it's up to date)</li>
  <li>I have tried to grant privileges</li>
  <li>I tried to get access with a new SQL user</li>
  <li>I have tried to enter all different passwords I have seen, so I don't think it's a password problem (EDIT)</li>
  </ul>
  
  <p>EDIT: Thanks for the posts, it seems that the following has nothing to do with the issue above.</p>
  
  <p>But after all this there is one thing that is really bugging me:
  When I type the following command in mysql:</p>
  
  <pre><code>show grants;
  </code></pre>
  
  <p>I get the following:</p>
  
  <pre><code>GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' IDENTIFIED BY PASSWORD 'NOT the plesk cleartext password'
  </code></pre>
  
  <p>The password displayed starts with an asterix (*) followed by random text and numbers.
  I tried to get access with this password, but it isn't recognized at all.</p>
  
  <p>I think this is weird, but I still can't find a solution.</p>