Posts

Showing posts with the label mysql

SCRIPT TO TAKE MYSQL DATABASE BACKUP FOR LAST 7 DAYS

  a. create a directory for database backup   and script:      mkdir /home1/db_backup b.  Create Directory and file:      mkdir /home1/script      cd /home1/script      touch dbbackup.sh c. Login to MYSQL console and run below commands     To Create read only  user: GRANT LOCK TABLES, SELECT ON *.* TO 'backup'@'localhost' IDENTIFIED BY 'readonly'; flush privileges; d. vi dbbackup.sh Copy Below Script #!/bin/sh #For taking backup DIR=/home/db_backup/ DATESTAMP=$(date +%d-%m-%y-%H-%M) DB_USER=backup DB_PASS='readonly' HOST=localhost # remove backups older than $DAYS_KEEP DAYS_KEEP=7 find ${DIR}* -mtime +$DAYS_KEEP -exec rm -f {} \; 2> /dev/null # create backups securely umask 006 # list MySQL databases and dump each DB_LIST=`mysql -h $HOST -u $DB_USER -p"$DB_PASS" -e'show databases;'` DB_LIST=${DB_LIST##Database} for DB in $DB_LIST; do FILENAME=${DIR}${DB}-${DATESTAMP}.sql.gz mysqldump -h ...

Deploy Drupal with MySQL in Docker Container

Image
  FIRST METHOD Before we install Drupal, we need to deploy MySQL. This is easily done with Docker by running the following command. In this command, replace “MYSQL-NAME” with a name for your MySQL Docker container. Also, replace “MYSQL-PASSWORD” with a new password for the container’s MySQL instance. Record both of these for later. docker run --name MYSQL-NAME -e MYSQL_ROOT_PASSWORD=MYSQL-PASSWORD -d mysql:latest Deploying and Configuring Drupal with Docker Our next step is to deploy a Drupal Docker container, connect it to your MySQL container, and finish configuring Drupal. Follow these steps. Run the following command. Replace “DRUPAL-NAME” with a name for your Drupal container. Replace “MYSQL-NAME” and “MYSQL-PASSWORD” with the values you used for your MySQL Docker container in the previous section. docker run --name DRUPAL-NAME --link MYSQL-NAME:mysql -p 8080:80 -e MYSQL_USER=root -e MYSQL_PASSWORD=MYSQL-PASSWORD -d drupal Go to  http://YOUR.VPS.IP:8080/  in ...