Skip to content

Instantly share code, notes, and snippets.

@alastori
alastori / meb-restore-backup-full.sh
Created May 13, 2016 19:50
Bash script to restore a full backup in MySQL 5.7 using MySQL Enterprise Backup 4.x
#!/bin/bash
#Bash script to restore a full backup in MySQL 5.7 using MySQL Enterprise Backup 4.x
#You need to privide the source of your backup (full path) as an argument
#Source can be a directory or a TAR file with the backup files created by MySQL Enterprise Backup
#MEB must be already installed
#You can find the binaries in http://support.oracle.com (preferable) or http://edelivery.oracle.com
#Modify these variables as you wish
MEB_HOME=/opt/mysql/meb-4.0
@alastori
alastori / upload-ftp.bat
Created June 11, 2016 20:40
Windows batch script to upload of one file passed as parameter using Windows FTP client
@ECHO OFF
REM ## Windows batch script to upload of one file passed as parameter using Windows FTP client
REM ## Modify the following variables as you wish
SET FTP_SERVER=
SET FTP_USER=
SET FTP_PASSWORD=
REM ## Test if can proceed
SET FILE_NAME=%1
@alastori
alastori / provision-unzip-rpm.sh
Created October 21, 2016 14:15
Bash script to provision Unzip via local RPMs in Enterprise Linux 7.x
#!/bin/bash
#Bash script to provision Unzip via local RPMs in Enterprise Linux 7.x
#Copy the unzip*.rpm file into the $PACKAGES_DIR and run this script as root
#You can find the binaries at https://rpmfind.net/linux/RPM/centos
#Modify these variables as you wish
PACKAGES_DIR=/home/vagrant/packages #This folder already contains RPMs
set -e # stop script execution on any error
@alastori
alastori / provision-mysql-community-57-el7-rpm-tar.sh
Last active October 22, 2016 16:15
Bash script to provision MySQL 5.7 Community via local RPMs in Enterprise Linux 7.x
#!/bin/bash
#Bash script to provision MySQL 5.7 Community via local RPMs in Enterprise Linux 7.x
#Copy the TAR with mysql* RPMs into the $PACKAGES_DIR and run this script as root
#You can find the community binaries in http://dev.mysql.com/downloads
#Modify these variables as you wish
DIR_TO_UNPACK=/tmp/packages
PACKAGES_DIR=/home/vagrant/packages #This folder already contains RPMs
MYSQL_PWD="Root#123"
@alastori
alastori / provision-mysql-commercial-57-el7-rpm-zip.sh
Last active October 22, 2016 16:18
Bash script to provision MySQL 5.7 Commercial via local RPMs (zipped) in Enterprise Linux 7.x
#!/bin/bash
#Bash script to provision MySQL 5.7 Commercial via local RPMs in Enterprise Linux 7.x
#Copy the ZIP file with mysql* RPMs into the $PACKAGES_DIR and run this script as root
#You can find the commercial binaries in http://support.oracle.com (preferable) or http://edelivery.oracle.com
#Modify these variables as you wish
DIR_TO_UNPACK=/tmp/packages
PACKAGES_DIR=/home/vagrant/packages #This folder already contains RPMs
MYSQL_PWD="Root#123"
@alastori
alastori / provision-mysql-commercial-57-el7-rpm-repo-tar-gz.sh
Last active October 22, 2016 17:37
Bash script to provision MySQL 5.7 Commercial via local RPMs (tar for local yum repo) in Enterprise Linux 7.x
#!/bin/bash
#Bash script to provision MySQL 5.7 Commercial via local RPMs in Enterprise Linux 7.x
#Copy the TAR with mysql* RPMs into the $PACKAGES_DIR and run this script as root
#You can find the commercial binaries in http://support.oracle.com (preferable) or http://edelivery.oracle.com
#Modify these variables as you wish
DIR_TO_UNPACK=/tmp/packages
PACKAGES_DIR=/home/vagrant/packages #This folder already contains RPMs
MYSQL_PWD="Root#123"
@alastori
alastori / update-static-hosts.sh
Created October 23, 2016 16:32
Script to update /etc/hosts with a list of Hosts and IPs
#!/bin/bash
#This script updates /etc/hosts with the list of Hosts and IPs bellow
#Run it as root
## Edit the list of host names and IPs as you wish
## Tip: you can check IPv4 with: ifconfig | grep "inet "
declare -A HOSTS
HOSTS[vmmysqltools]=172.28.128.250
HOSTS[vmmysqlserver1]=172.28.128.240
HOSTS[vmmysqlserver2]=172.28.128.241
@alastori
alastori / update-ssh-rsa-key.sh
Created October 24, 2016 01:02
This script updates ssh_host_rsa_key with a new one generated by ssh-keygen
#!/bin/bash
#This script updates ssh_host_rsa_key with a new one generated by ssh-keygen
#Run it as root
echo "Old ssh rsa key:"
ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
echo -e 'y\n'|ssh-keygen -t rsa -N '' -f /etc/ssh/ssh_host_rsa_key
echo "New ssh rsa key:"
ssh-keygen -l -f /etc/ssh/ssh_host_rsa_key.pub
@alastori
alastori / provision-mysql-community-57-el7-yum.sh
Last active November 4, 2016 15:37
Bash script to provision MySQL 5.7 Community via public yum repository in Enterprise Linux 7.x
#!/bin/bash
#Bash script to provision MySQL 5.7 Community via mysql.com public yum repository in Enterprise Linux 7.x
#MySQL yum repository from http://dev.mysql.com/downloads/repo/yum/ must already be installed
#Run this script as root
#Modify these variables as you wish
DIR_TO_DOWNLOAD=/opt/mysql/packages
MYSQL_PWD="Root#123"
REMOTE_USER=remote
@alastori
alastori / provision-mysql-yum-repo-el7.sh
Last active November 4, 2016 16:25
This script download and install MySQL public YUM repository in Enterprise Linux 7.x
#!/bin/bash
#Bash script to provision MySQL public YUM repository in Enterprise Linux 7.x
#Check if $REPO_RPM_URL is updated at http://dev.mysql.com/downloads/repo/yum/
#Modify these variables as you wish
DIR_TO_DOWNLOAD=/opt/mysql/packages
REPO_RPM_URL=http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
set -e # stop script execution on any error