title: ERROR 1396 (HY000): Operation CREATE USER failed for 'username'@'localhost' IDENTIFIED BY 'mypassword';
body: <p>Mistakenly I deleted my root user from my <code>mysql.user</code> table.</p>
  
  <pre><code>delete from mysql.user where user='username';
  </code></pre>
  
  <p>To make same root user, I am trying to fire below query,</p>
  
  <pre><code>CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
  </code></pre>
  
  <p>I get error as </p>
  
  <p><code>ERROR 1396 (HY000): Operation CREATE USER failed for 'username'@'localhost'</code></p>
  
  <p>As per <a href="https://stackoverflow.com/questions/5555328/error-1396-hy000-operation-create-user-failed-for-jacklocalhost">this SO answer</a>, I tried <code>FLUSH PRIVILEGES;</code>, but still I get same error.</p>
  
  <p>Any idea what is going wrong?</p>
  
  <hr>
  
  <h2>Answer</h2>
  
  <p>I also had to delete the same from <code>mysql.db</code> table</p>
  
  <pre><code>delete from mysql.db where user='username';
  </code></pre>
  
  <p>That's it...</p>