In order to fix the error “access denied for user root@localhost’” after MySQL installation, follow the steps below.
First, you would have to type in the command below in your terminal.
You will be prompted for the password. Go ahead and enter your super user password.
Next run the command below :
update mysql.user set plugin = ‘mysql_native_password’ where User=’root’
Once this is done, you would need to flush the privileges using the commands below :
Finally type in the command below to exit :
Now, Simply invoke the command below in your terminal.
mysql -u root -p
You will be asked for the password. Once done, you will login successfully into the console.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.