Celebrate Our 22nd Anniversary with Huge Savings! Up to 70% Off

MySQL Access denied for user 'Mysql_dbuser'@'localhost' (using password YES) in homecPanel_userpublic_htmlfile path.php

You may face this error while using the mysqli_connect function on your website.

Cause
This may be an issue with all privileges of your MySQL DB user on the database.

Fix
You can fix this issue by entering the command through SSH or cPanel.

(1) Command Line
The command given below will provide all the privileges to a user on the database – 

grant all on .* to mysql_user@localhost; flush privileges;

(2) cPanel
Please refer to the steps given below to fix this error if you have cPanel access – 

1. Log in to your cPanel.

2. Click on MySQL Databases.

MySQL Database

3. Go to the Add User to Database section.
Select your user and database in your respective drop-down and click the Add button.

Add User to Database

4. Tick on All Privileges and click on the Make Changes button.
It will provide all the permission for your database user to access your database.

Make Changes

This should fix your issue of Access Denied for user 'Mysql_dbuser'@'localhost.'


Was this answer helpful?

« Back

chat