edward19283 Posted October 12, 2005 Posted October 12, 2005 Personally, I always use either the backup and restore function, or a short script which does a mysql dump, and then emails my backup every day. I seem to be having a problem with my script to do a simple mysql backup. Here is the script: mysqldump -u cpanelusernamename_dbusername -ppassworrd cpanelname_dbname | gzip -c > /home/cpanelname/backups/backup-dbname.sql.gz cpanelusernamename = your login username for cpanel password = your password for the dabase (note, there is NO space between -p and password) dbname = the name of your database The error I am getting is: mysqldump: Got error: 1045: Access denied for user: 'cpanelusernamename_dbusername@localhost' (Using password: YES) when trying to connect Also, I would like to do a simple backup of a directory. What would the the script to do that? Thanks. Quote
TweezerMan Posted October 13, 2005 Posted October 13, 2005 The error I am getting is:mysqldump: Got error: 1045: Access denied for user: 'cpanelusernamename_dbusername@localhost' (Using password: YES) when trying to connect That error can be caused by a number of things: 1) the database username is not correct, 2) the database password is not correct, 3) the database user has not been properly added to the database (granting the database user permission to access the database). I don't know if this is relevant, but you have 'cpanelusernamename_dbusername' for the database username and 'cpanelname_dbname' for the database name. These should be both be prefixed with the same thing - your CPanel username and an underscore ('cpanelname_'). Also, I would like to do a simple backup of a directory. What would the the script to do that? Thanks. You might try looking at sites such as hotscripts.com for something like that. Quote
edward19283 Posted October 13, 2005 Author Posted October 13, 2005 I checked usernames and passwords and made sure I was using my cpanel username where appropriate and still got the same problem. I created a new dbusername and password and added it to the database with all priviledges and created a new cron with this information and I got the same response, copied below, except it now says it is not using the password. Enter password: mysqldump: Got error: 1045: Access denied for user: 'cpanelusername_dbusername@localhost' (Using password: NO) when trying to connect I looked around hotscripts.com, per your suggestion and found another script for mysql backups (automysqlbackup). I decided to try it and configured it to run through cron and it appears to be having the same problem, "Access denied for user". Its error message is copied below: mysqldump: Got error: 1044: Access denied for user: '@localhost' to database 'dbname1' when selecting the database /home/cpanelusername/automysqlbackup.sh.2.2: line 572: /bin/mail: Permission denied Any suggestions? Thanks. Quote
edward19283 Posted October 13, 2005 Author Posted October 13, 2005 Also, I would like to do a simple backup of a directory. What would the the script to do that? Thanks. I found instructions on using tar to backup the directory, located here: http://www.tldp.org/LDP/lame/LAME/linux-ad...ver-backup.html It seems to be working fine for me. Quote
edward19283 Posted October 21, 2005 Author Posted October 21, 2005 I submitted a trouble ticket with TCH and there was a syntax error in my cron job. Here is the cron that is working for me: mysqldump -u cpanelusername_dbname --password='password' cpanelusername_dbname | gzip -c > /home/cpanelusername/path Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.