# Fix Access Denied For User root@localhost using password Yes -MariaDB Cloudpanel

**URL:** <https://forum.hhf.technology/t/fix-access-denied-for-user-root-localhost-using-password-yes-mariadb-cloudpanel/360>\
**Category:** Databases\
**Tags:** cloudpanel, mariadb\
**Created:** [November 5, 2024, 5:41pm UTC](https://forum.hhf.technology/t/fix-access-denied-for-user-root-localhost-using-password-yes-mariadb-cloudpanel/360 "2024-11-05T17:41:16Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![hhf.technoloy](https://forum.hhf.technology/user_avatar/forum.hhf.technology/hhf.technoloy/32/68_2.png) [@hhf.technoloy](https://forum.hhf.technology/u/hhf.technoloy)\
**Post date:** [November 5, 2024, 5:41pm UTC](https://forum.hhf.technology/t/fix-access-denied-for-user-root-localhost-using-password-yes-mariadb-cloudpanel/360/1 "2024-11-05T17:41:16Z")

</div>

## ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)

## An exception occurred in the driver: SQLSTATE[HY000] [1045] Access denied for user ‘root’@‘localhost’ (using password: YES)

OR

 ![image](https://forum-cdn.hhf.technology/original/1X/90c37896287e9924db664e2f2daef2ef5f2b9b5a.jpeg)

# SOLUTION:—

```bash
systemctl stop mysql

```

```bash
 mysqld_safe --skip-grant-tables &

```

```bash
mysql -u root

```

```mysql
ALTER USER ‘root’@’127.0.0.1’ IDENTIFIED WITH mysql_native_password USING PASSWORD(‘password’) ;
flush privileges;

```

**The above solution will work for MariaDB. MariaDB is not same as MYSQL.**

After changing the password and if you are using cloudpanel you can run the below command and check if the root password is changed or not.

```bash
clpctl db:show:master-credentials

```

 ![image](https://forum-cdn.hhf.technology/original/1X/b835d3b701f4641d4a0eee9464aafcf8cdba4767.png)

## IF MySQL

```mysql
ALTER USER ‘root’@’127.0.0.1’ IDENTIFIED WITH mysql_native_password BY ‘test’;

```

Hope this helps.

Thank you.
