Last Updated on June 20, 2019
Updated July 2022: Stop getting error messages and slow down your system with our optimization tool. Get it now at this link
- Download and install the repair tool here.
- Let it scan your computer.
- The tool will then repair your computer.
MySQL is an open source database management system based on the SQL language. MySQL comes with the XAMPP control panel, which is also an open source and freely usable application. Recently, however, many reports have been received from users who cannot access their “MySQL” database via their browser and the error “Access Denied for Use’root’ @’localhost'” is displayed.
The reason for this problem is that you do not grant global permissions to the user. So, once you have given the user global permissions for the selection, the problem will be fixed.
In this article, we will guide you in the simplest way to solve this problem and also inform you of the reason for this error. Follow the instructions carefully to avoid further problems.
To resolve the Access denied error for the user ‘root’ @’localhost’ in the MySQL error
- Open and edit /etc/my.cnf or /etc/mysql/my.cnf depending on your distribution.
- Add the subsidy jump tables in[mysqld].
- Restart Mysql
- You should now be able to connect to mysql with the following command mysql -u root -p
- Run mysql> rinse privileges ;
- Set a new password with ALTER USER’root’ @’localhost’ IDENTIFIED by’NewPassword’;
- Return to /etc/my.cnf and delete/comment the subsidy jump tables.
- Restart Mysql
- You can now log in with the new mysql -u root -p password.
Start MySQL in secure mode without password
mysqld_safe –skip-grant-tables &
Warning: It’s dangerous! I had no data in any of my tables, which means I wasn’t worried about malicious readings. The “Skip” option allows anyone to log in with all privileges without a password. If you have concerns about your tables, you should also disable any remote access:
Another effective workaround solution
Perform the following steps.
Start the MySQL server instance or daemon with the –skip-grant-tables option.
$ mysqld — skip-grant-tables
Follow these instructions.
$ mysql -u root mysql mysql mysql mysql mysql
$mysql> UPDATE user SET Password=PASSWORD(‘my_password’) or USER=’root’ ;
$mysql> PRIVILEGE FLUSHES;
If you are confronted with the unknown field Password error on use:
update user set authentication_string=password(‘my_password’) where user=’root’ ;
Finally, restart the instance/daemon without the –skip-grant-tables option.
You should now be able to log in to your new password.
$ mysql -u root -p
Enter the password: my_password
Expert Tip: This repair tool scans the repositories and replaces corrupt or missing files if none of these methods have worked. It works well in most cases where the problem is due to system corruption. This tool will also optimize your system to maximize performance. It can be downloaded by Clicking Here
CCNA, Web Developer, PC Troubleshooter
I am a computer enthusiast and a practicing IT Professional. I have years of experience behind me in computer programming, hardware troubleshooting and repair. I specialise in Web Development and Database Design. I also have a CCNA certification for Network Design and Troubleshooting.