1

Access denied for user 'root'@'localhost'

I am getting this error with adminer.php and phpmyadmin won't work either. I am able to run SQL commands in terminal after typing 'sudo mysql'. I have a user table with root as a username but there is no password field.

If anyone can help me to get this to work it would be great.

Olympus
  • 21

3 Answers3

1

This solved my problem - can't login as mysql user root from normal user account in ubuntu 16.04

I'm using Ubuntu 18.04 and so these instructions work for me.

Olympus
  • 21
0

write this this command in your terminal with root user

getsebool -a | grep http

and look to httpd_read_user_content if it's off then you have to make it on by this command

setsebool -P httpd_read_user_content on 

then restart your apache server and try to access to adminer and phpmyadmin

0

In newer versions of MariaDB/MySQL the default root user authentication method on Linux is unix socket. In other words, only the root user itself can login to the MySQL root user account (and no password is needed).

As unix socket authentication is the most secure way to authenticate, IMO the best way to go is to create a new root-like user (that does require a password) for use with Adminer (and/or other DB interfaces that require a user is authenticated via password).

Jeremy Davis
  • 134
  • 11