03-Apr-2023
.
Admin
Hello Friends,
The “Access denied for user ‘root’@’localhost’ (using password yes/no)” error usually occurs when you are trying to log in to PHPMyAdmin with incorrect credentials or when the MySQL server is not configured correctly.
This tutorial will provide an example of how to fix an error of phpmyadmin access denied in xampp MySQL. I’m going to show you about fixing access denied for user root @ localhost for PHPMyAdmin. In this article, we will implement a phpmyadmin access denied for the user root localhost using a password. This article goes into detail on phpmyadmin access denied for user root @ localhost. Alright, let’s dive into the steps.
Step 1: Login as Root user MySQL
Installed MySQL and try to access phpmyadmin on the local/server machine with the root user, the command you use is:
mysql -u root -p
In most cases, you will receive the error message Access denied for user ‘root’@’localhost’.
You can enable access for root using one MySQL command.
To be able to log into MySQL as root, first use sudo to modify the root user:
sudo mysql
Enter your password at the prompt. A MySQL shell loads.
This command changes the password for the user root and sets the authentication method to mysql_native_password. This is a traditional method for authentication, and it is not as secure as auth_plugin. In the example above, we set “root” as the password, but we encourage you to set a stronger password.
mysql> FLUSH PRIVILEGES;
Step 2: Restart Apache Server
You need to restart Apache 2 server by using the following command:
sudo service apache2 restart
Step 3: Test Root MySQL User For Access PHPMyadmin
Finally, you can log in as root from phpMyAdmin. So, open your browser and type the below URL with your ec2 server ip:
http://[SERVER_PUBLIC_IP]/phpmyadmin
Then you will look like this on your browser:
I hope it can help you...
#Ubuntu