title: Re-enable root access in mysql
body: <p>I recently installed mysql on my (cloud) server and then I ran <code>sudo /usr/bin/mysql_secure_installation</code> and disallowed remote root login. Then I created another user to run all my queries and gave it appropriate permissions. I can't remember the password now (or password got changed somehow) and am unable to connect to mysql. Whenever I try to connect using <code>mysql -u user -p</code> I get the following error</p>
  
  <p><code>ERROR 1045 (28000): Access denied for user 'user'@'localhost' (using password: YES)
  </code></p>
  
  <p>I tried following what answers to other question here on SO suggested but most of them require access to mysql shell. </p>
  
  <p>I also tried to reconfigure using 
  <code>sudo dpkg-reconfigure mysql-server-5.5</code> (my version number is 5.5.41). </p>
  
  <p>Using this I am able to set the root password but still can't connect it. I also tried running mysql in safe mode, as suggested by some user, with no luck.</p>
  
  <p>Last thing I could think of was somehow renable the remote access for root, since I can reset it's password, and then reset the <code>user</code> password through mysql shell. So, I tried looking the <code>/etc/mysql/my.cnf</code> file but didn't see anything relevant.</p>
  
  <p>Is there anything I am missing? How can I reset the password and get access again? </p>