title: MySQL: Access denied for user root@localhost
body: <p>I have tried to fix this since 3 hours now, I have grown so tired. All I want to do is ssh into a webserver, install mysql and use it. I have installed it on Ubuntu 16.04 via <code>sudo apt-get install mysql-server</code>. And no, I was not asked for a root password which so many people claim should happen on Ubuntu 16.04. <strong>Next I try <code>sudo mysql -u root -p</code> and then the prompt says "Enter password:". I have not ever set a password so I just hit enter and get <code>Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)</code></strong>. </p>
  
  <p>Frustration part / skippable: I found sooo many "solutions" where <a href="https://stackoverflow.com/a/42742610/13154227">people say</a> "Hey just start mysql and use this commend to authenticate the root user by this password" but it doesn't work, I cannot ACCESS mysql AT ALL, only ssh into the server works (hey, at least I'm there, yay). People have claimed I should use <code>-h</code> paramter, I've tried it all, using <code>-h</code> with 127.0.0.1 and the servers ip address, NOTHING works. I really hope someone who really KNOWS what he's talking about can step in and provide an in-depth explanation of the matter. Does it have to do with sockets? Is it just a password matter? Does it have to do with ssh? I cannot identify the problem and nobody takes the time to pass on knowledge instead of providing should-work-answers. How can it be so difficult to just install and use mysql, I can't believe I'm losing so much time on this :(</p>