MySQL Backup Script

#!/bin/bash export PATH=/bin:/usr/bin:/usr/local/bin TIMESTAMP=`date +”%Y%d%m-%H%M”` DB_BACKUP_PATH=’/backup/dbbackup’ MYSQL_HOST=’localhost’ MYSQL_PORT=’3306′ MYSQL_USER=’root’ MYSQL_PASSWORD=’mysecret’ DATABASE_NAME=’mydb’ echo “Backup started for database – ${DATABASE_NAME}” mysqldump -h ${MYSQL_HOST} \ -P ${MYSQL_PORT} \ -u ${MYSQL_USER} \ -p${MYSQL_PASSWORD} \ ${DATABASE_NAME} | gzip –best > ${DB_BACKUP_PATH}/${DATABASE_NAME}-${TIMESTAMP}.sql.gz if [ $? -eq 0 ]; then echo “Database backup successfully completed” else echo “Error found during backup” exit … Read more

Reset the MariaDB Root Password

If you forget your root MariaDB password, don’t worry and be sad because it can be reset easily with this tutorial. Stop the current MariaDB server instance, then restart it with an option to not ask for a password: systemctl stop mariadb mysqld_safe –skip-grant-tables & Reconnect to the MariaDB server with the MariaDB root account: … Read more