Few MySQL commands

1)employee and books are tow tables. Common fields are department. need information from 2 tables. Answer : # select employee.id, employee.name, books.bookname from employee, books where employee.dept=books.dept; 2)Print Name of the employee who can use bookname=’orgonic’ employee table has name Read More …

DB Backup script :-

DB Backup script :- #! /bin/bash TIMESTAMP=$(date +”%F”) BACKUP_DIR=/temp/My-Backup-$TIMESTAMP MYSQL_USER=”your-db-username” MYSQL=/usr/bin/mysql MYSQL_PASSWORD=”your-db-username-password” MYSQLDUMP=/usr/bin/mysqldump DATABASE=your-db-name mkdir -p “$BACKUP_DIR/mysql” $MYSQLDUMP –force –opt –user=$MYSQL_USER -p$MYSQL_PASSWORD $DATABASE | gzip > “$BACKUP_DIR/mysql/$DATABASE.gz”

MySQL Replication

http://www.clusterdb.com/mysql-cluster/get-mysql-replication-up-and-running-in-5-minutes https://www.digitalocean.com/community/tutorials/how-to-set-up-master-slave-replication-in-mysql http://www.rackspace.com/knowledge_center/article/set-up-mysql-master-slave-replication https://www.percona.com/doc/percona-xtrabackup/2.1/howtos/setting_up_replication.html#step-3-configure-the-master-s-mysql-server Set up MySQL master-slave replication Master-slave data replication allows for replicated data to be copied to multiple computers for backup and analysis by multiple parties. Needed changes identified by a group member must to be submitted to Read More …