#!/bin/bash# MySQL credentialsUSER="root"#账号PASSWORD="123456"#密码DATABASE="test"#数据库名BACKUP_FILE="/home/dev/mysql/test-2024-06-04.sql.sql"#数据库备份的目录# Run mysql to restore
mysql -u$USER -p$PASSWORD$DATABASE<$BACKUP_FILE# Check if the command succeededif[$?-eq0];thenecho"Restore succeeded: $DATABASE"elseecho"Restore failed"fi