mysqldump: Got error: 1045: Access denied for user

Nirjonadda

Well-Known Member
May 8, 2013
752
28
78
cPanel Access Level
Root Administrator
Please let me know that how to fix mysqldump: Got error: 1045: Access denied for user?

Code:
[30-Aug-2017 02:02:00] WARNING: [pool mysite_com] child 13234 said into stderr: "mysqldump: Got error: 1045: Access denied for user 'user'@'localhost' (using password: YES) when trying to connect"
 

Eminds

Well-Known Member
Nov 10, 2016
319
32
28
India
cPanel Access Level
Root Administrator
you must be logged in with the root user to the server in order to create mysqldump. while backing up the data use -u root -p mysql password root password and then check.
 

Nirjonadda

Well-Known Member
May 8, 2013
752
28
78
cPanel Access Level
Root Administrator
you must be logged in with the root user to the server in order to create mysqldump. while backing up the data use -u root -p mysql password root password and then check.
I am using one addon for xenforo ForumBackup. It appears the user connecting to my xenforo database doesn'f have authority to use the mysqldump command? mysql password is root password have set up in“.my.cnf” in home directory. Please let me know that how we can fix this problem?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Hello,

Are you able to verify the correct database username and database name is utilized by your script's plugin when attempting to backup the database? Also, try accessing SSH as the account username and running the following command to verify it works as expected:

Code:
mysqldump -u username -p database_name > /home/$username/db_backup.sql
Thank you.
 

Nirjonadda

Well-Known Member
May 8, 2013
752
28
78
cPanel Access Level
Root Administrator
Hello,

Are you able to verify the correct database username and database name is utilized by your script's plugin when attempting to backup the database? Also, try accessing SSH as the account username and running the following command to verify it works as expected:

Code:
mysqldump -u username -p database_name > /home/$username/db_backup.sql
Thank you.
No, plugin does not have any option to enter database username and database name. Its just work from Xenforo Database. This issue happened from new server. Yes following command are working but with this command where the database files are save?
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Yes following command are working but with this command where the database files are save?
The backup files are located at "/home/$username/db_backup.sql" in this example. As far as the plugin, could you report the issue to the plugin developer to see how the MySQL backup is generated in the code?

Thank you.
 

Nirjonadda

Well-Known Member
May 8, 2013
752
28
78
cPanel Access Level
Root Administrator
The backup files are located at "/home/$username/db_backup.sql" in this example. As far as the plugin, could you report the issue to the plugin developer to see how the MySQL backup is generated in the code?

Thank you.
I think Its happened from after using php-fpm.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
I think Its happened from after using php-fpm.
Do you notice any specific output in /opt/cpanel/ea-php$$/root/usr/var/log/php-fpm/error.log when this happens? Replace "ea-php$$" with the version of PHP associated with the account (e.g. ea-php56).

Thank you.
 

Nirjonadda

Well-Known Member
May 8, 2013
752
28
78
cPanel Access Level
Root Administrator
Do you notice any specific output in /opt/cpanel/ea-php$$/root/usr/var/log/php-fpm/error.log when this happens? Replace "ea-php$$" with the version of PHP associated with the account (e.g. ea-php56).

Thank you.
/opt/cpanel/ea-php71/root/usr/var/log/php-fpm/error.log

Code:
[07-Sep-2017 02:01:06] WARNING: [pool mysite_com] child 23116 said into stderr: "mysqldump: Got error: 1045: Access denied for user 'nadda'@'localhost' (using password: YES) when trying to connect"
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Hello,

Can you verify that no additional entries appear in that log file before or after that error message near the same time stamp?

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Feel free to open a support ticket using the link in my signature if you'd like us to take a closer look.

Thank you.
 

cPanelMichael

Administrator
Staff member
Apr 11, 2011
47,884
2,243
463
Hello,

To update, it looks like this stemmed from the use of a my.cnf file in the account's home directory with a password that did not match the cPanel account's password.

Thank you.