Reputation: 609
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 sudo apt-get install mysql-server
. And no, I was not asked for a root password which so many people claim should happen on Ubuntu 16.04. Next I try sudo mysql -u root -p
and then the prompt says "Enter password:". I have not ever set a password so I just hit enter and get Error 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
.
Frustration part / skippable: I found sooo many "solutions" where people say "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 -h
paramter, I've tried it all, using -h
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 :(
Upvotes: 0
Views: 6675
Reputation: 609
I found the answer, thank you so much. More than a year ago I had installed mysql-server on that same server and I had set a password. It didn't come to my mind since I had purged everything. There should definitely be a warning like "do you want to use your old databases?" during installation. Just something, anything, that gives you a hint. I have closed roughly 100 tabs, all pointing in the wrong direction ("bind" settings, ssh tunnel, -h option, start a safe daemon and what not). So basically I have deleted /var/lib/mysql and everything was solved.
Upvotes: 2
Reputation: 380
You should run 'mysql_secure_installation' for a fresh MySQL installation, this will tidy up a default installation and prompt you for a password for the MySQL root user.
Upvotes: 1