• Our team is looking to connect with folks who use email services provided by Plesk, or a premium service. If you'd like to be part of the discovery process and share your experiences, we invite you to complete this short screening survey. If your responses match the persona we are looking for, you'll receive a link to schedule a call at your convenience. We look forward to hearing from you!
  • The BIND DNS server has already been deprecated and removed from Plesk for Windows.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS. We strongly recommend transitioning to Microsoft DNS within the next 6 weeks, before the Plesk 18.0.70 release.
  • The Horde component is removed from Plesk Installer. We recommend switching to another webmail software supported in Plesk.

MySQL db backup script not working

Status
Not open for further replies.

DeanC@

Basic Pleskian
Hi! This is on a CentOS 7.1, Plesk 12. New.

On Plesk 10.4 I had a script that backed up my MySQL databases separately. The script doesn't work now. I get an error:

ERROR 1045 (28000): Access denied for user 'admin'@'localhost' (using password: YES)​

Do I need to do something different with this new "MariaDB" thing?

Here's the script:

DB_BACKUP="/pat/to/databackup/`date +%Y-%m-%d`"
DB_USER="admin"
DB_PASSWD="-p`cat /etc/psa/.psa.shadow`"
HN=`hostname | awk -F. '{print $1}'`

# Create the backup directory
mkdir -p $DB_BACKUP

# Remove backups older than 10 days
find /var/www/vhosts/insightplanners.com/docs/databackup/ -maxdepth 1 -type d -mtime +10 -exec rm -rf {} \;

# Backup each database on the system using a root username and password
for db in $(mysql --user=$DB_USER --password=$DB_PASSWD -e 'show databases' -s --skip-column-names|grep -vi information_schema);
do mysqldump --user=$DB_USER --password=$DB_PASSWD --opt $db | gzip > "$DB_BACKUP/mysqldump-$HN-$db-$(date +%Y-%m-%d).gz";
 
Have you tried to check your connection with

# mysql -uadmin -p`cat /etc/psa/.psa.shadow`

Does it work?
 
Yes, and from that I get:

MariaDB [(none)]>

I can do all things MySQL from the command line, and all scripts are working on dozens of domains.

Thanks for your reply.
 
And the script, "mysql_backup.sh," is in the same directory (/usr/local/bin) and has the same owner (root) and permissions (rwx) on both servers.

And I tried substituting the actual password for "-p`cat /etc/psa/.psa.shadow`"
 
Well, I guess something in the file got corrupted in the migration. I replaced the script with a copy from my computer, and now it works. Sorry for the trouble!
 
Status
Not open for further replies.
Back
Top