How to solve the “Access denied for root” error on PhpMyAdmin log in?

Windows Articles

How to Backup your call and SMS history in Android

Many times we find ourselves in the situation of having to change our phone, for different reasons, and one of the questions...

Install and configure Apache Guacamole on Debian 10

Hello, friends in this post, you will learn how to install and configure Apache Guacamole in Debian 10. It will be a...

Ubuntu 20.10 available

The new version of Ubuntu is now available, under the code name "groovy gorilla". Ubuntu 20.10 focuses on improving and refining the...

Monitoring Ubuntu 20.04 with Stacer

Normally if we use Linux on a production server, it is important to monitor it. On the other hand, in everyday use, many users...

How to get the Android 11 Notification Panel

It's no secret that even though Android is the most widely used mobile operating system. Not always our device has the latest...
angeloma
angeloma
Senior Writer and partner

In our recent article, we explain how to install the latest PhpMyAdmin on Ubuntu 18.04. We explain the advantages that this may have. For example, with the updates to the program improves its usability and stability. This is important when working with data. However, you may not be able to log in as a root user. That is why in this post I will show you How to solve the “Access denied for root” error on PhpMyAdmin log in?

The “Access denied for root” error on PhpMyAdmin log in

The problem arises because, from version 5.7 of MySQL and MariaDB 10, the root user will only be able to log in if it is executed as superuser. That is, PhpMyAdmin runs through the non-root user of the operating system. Then, from PhpMyAdmin the root user cannot be logged in.

This situation can be very annoying but it has its reason to be. Those of us who administer databases know that it is not recommended to leave the root user enabled. This is because if the root user is compromised, all data will be compromised. The correct security policy is not to allow its use unless you use remote access with strong security policies.

On the other hand, PhpMyAdmin also understands this situation and does not attempt to provide a solution that could compromise server security.

So, what is the solution?

The optimal solution is to create a new user with all permissions on the database. With this, you will be able to perform many operations from PhpMyAdmin without any logging problems.

To do this, we need to open a terminal and connect to our MySQL or MariaDB server.

Note that to use the root user in MySQL / MariaDB you must use sudo. If you remove it, it will give the same error as in PhpMyAdmin. That is, the error comes from MySQL / MariaDB.

:~$ mysql -u root -p
ERROR 1698 (28000): Access denied for user 'root'@'localhost'

So, you have to use sudo or to be the system root user.

:~$ sudo mysql -u root -p

Next, create the new user.

>CREATE USER 'new_user'@'%' IDENTIFIED BY 'your-password';

Note: The % sign means that the new user will be able to connect to the MySQL / MariaDB server from any IP.

Then assign the permissions to this new user.

> GRANT ALL PRIVILEGES ON *.* TO 'new_user'@'%' WITH GRANT OPTION;

1.- Fixing the error on the phpmyadmin log in
1.- Fixing the error on the phpmyadmin login

Now open your PHPMyAdmin and you should be able to log in with your new user.

2.- Phpmyadmin log in
2.- Phpmyadmin log in

3.- Phpmyadmin working
3.- Phpmyadmin working

So, for security reasons PhpMyAdmin cannot log in as root user, however to solve the situation you can create another user with similar permissions.

Conclusion

In this post, you have learned to solve The “Access denied for root” error on PhpMyAdmin log in. This way you will be able to enjoy this great MySQL / MariaDB administration program.

You can also read: How to reset the MySQL / MariaDB root password?

Please share this post with your friends.

More articles

2 COMMENTS

  1. I created a user joker@’%’ and config Require all grant (Require IP too in other moment) in file configuration phpmyadmin. I failed with login with phpmyadmin, however I can login into terminal…

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to Backup your call and SMS history in Android

Many times we find ourselves in the situation of having to change our phone, for different reasons, and one of the questions...

Install and configure Apache Guacamole on Debian 10

Hello, friends in this post, you will learn how to install and configure Apache Guacamole in Debian 10. It will be a...

Ubuntu 20.10 available

The new version of Ubuntu is now available, under the code name "groovy gorilla". Ubuntu 20.10 focuses on improving and refining the...

Monitoring Ubuntu 20.04 with Stacer

Normally if we use Linux on a production server, it is important to monitor it. On the other hand, in everyday use, many users...

How to get the Android 11 Notification Panel

It's no secret that even though Android is the most widely used mobile operating system. Not always our device has the latest...
x