Access Denied for user 'root'@'localhost' phpMyAdmin

Websolutionstuff | Jul-28-2023 | Categories : Other

phpMyAdmin is a valuable web-based tool for managing MySQL databases, simplifying various database tasks. However, running into the frustrating "Access Denied" error for the user 'root'@'localhost' can hinder your progress.

In this article, we'll delve into the causes behind this error and provide practical solutions to overcome it. Whether you're encountering the 'root'@'localhost' access denied issue on Ubuntu or XAMPP, we've got you covered.

When attempting to log in as the root user, you might find yourself locked out of phpMyAdmin, especially when using MySQL 5.7.26 on Ubuntu versions like 18.04, Ubuntu 20.04, or Ubuntu 22.04. The error message you'll encounter is the same

Mysqli_real_connect(): Access denied for user ‘root’@‘localhost’

access_denied_for_user_error

This issue arises from the fact that the Plugin for the root user is auth_socket.

To see this status enter MySQL by

sudo mysql -u root -p

After that, run the following command.

mysql>  SELECT User, Host, plugin FROM mysql.user;

You will see:

mysql-users-list

To fix this issue use this command:

mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'YOUR_ROOT_PASSWORD';

Note: YOUR_ROOT_PASSWORD’ which must be your root password.

The status must be finally the same as:

set_mysql_root_password

And again try to log in phpMyAdmin via the root user and your password.

http://example.com/phpmyadmin
or
http://127.0.0.1/phpmyadmin

 


You might also like:

Recommended Post
Featured Post
Custom Toastr Notification In Laravel 9
Custom Toastr Notification In...

In this article, we will see a custom toastr notification in laravel 9. we will create a custom notification using HTML,...

Read More

Sep-23-2022

Dependent Dropdown In Laravel 9 Vue JS
Dependent Dropdown In Laravel...

In this article, we will see a dependent dropdown in laravel 9 vue js. Here, we will learn how to create a dependent dro...

Read More

Dec-15-2022

Laravel 9 Where Condition Example
Laravel 9 Where Condition Exam...

In this article, we will see laravel 9 where condition example. Where condition is essential in each and every quer...

Read More

Oct-12-2022

How To Install TinyMCE Editor In Laravel
How To Install TinyMCE Editor...

In this article, I will give you an example of the TinyMCE editor, Tinymce editor is a rich-text open-source editor,&nbs...

Read More

Jun-18-2020