I'm trying to install LAMP on ubuntu 16.04. I had everything installed, but accidentally locked myself out of LAMP trying to get phpmyadmin working, I get Access denied for user 'root'@'localhost'
with whatever I try.
I thought the easiest solution would be to uninstall all packages I installed to get LAMP working. I used sudo apt-get purge
to uninstall all packages I installed. Now I'm installing all packages again but I get the same error when trying to install mysql. I try: sudo mysql_secure_installation
and it asks me for the password for root. I tried leaving it empty, giving the passwords I think I set for root, but everything just returns the access denied message.
Trying to get into mysql with mysql -u root -p
always returns the access denied message, I tried a solution by creating a file with CREATE USER 'root'@'localhost' IDENTIFIED BY '<password>';
and running
sudo mysqld_safe --init-file=<path_to_file>
but I still receive the access denied messages.
I'm thinking there is a file somewhere with the information, maybe the password, it needs. I tried a lot of other solutions too but nothing seems to work.
EDIT:
I investigated further, and I tried starting the mysql service with the --skip-grant-tables
flag to stop checking user privs. When I run mysql -u root
it still tells me ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
. I think the problem hasn't to do with my password, but something else.
purge
when uninstalling (that is if you installed throughapt-get
). – Juan Antonio Nov 4 '16 at 11:36