[Solved] Errorr: Access denied for the user root@localhost(using password: NO) in MariaDB and MySql

on Apr 28, 2022 11:02 PM


I installed mysql 8.0 and maria db 10.3.34 (64 bit)in my laptop and set password for root.

now the issue is : whenever i restart my pc ,the below messgae is showing while clicking to root account.

Access denied for the user 'root@localhost'(using password: NO)

No i have to reinstall maria db, ten only i can access the root use. how can i settle this issue.


Download FREE API for Word, Excel and PDF in ASP.Net: Download
on Apr 28, 2022 11:17 PM
on Apr 28, 2022 11:18 PM


Execute the below queries.

-- for MySQL
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

-- for MariaDB
ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('root');

With this query you are changing the auth_plugin to mysql_native_password and setting the root password to root.

Now you will able to log in with root.

For more details refer MySQL or MariaDB.

If this will not help follow the steps in the below link.