RSYNC script for automated backup for CentOS


#!/bin/bash

RSYNC=/usr/bin/rsync
SSH=/usr/bin/ssh
KEY=~/.ssh/id_rsa
RUSER=root
RHOST=0.0.0.0
RPATH1=/var/www/html
RPATH2=/home/sshuser/sqldump
LPATH1=/var/www
LPATH2=/home/sshuser
DT=$(date +%d%m%y)

rm -f /home/sshuser/sqldump/*sql
$SSH -i $KEY $RUSER@$RHOST mysqldump -u root -ppassword databasename > /home/sshuser/sqldump/databasename.sql
$RSYNC -tav -e “$SSH -i $KEY” $RUSER@$RHOST:$RPATH1 $LPATH1
cd /home/sshuser/sqldump/

mysql -u root -ppassword databasename < databasename.sql

Re-Starting MySQL & Web Service
service mysqld restart
service httpd restart

Path Details
/home/sshuser/sqldump

Output Details in Localhost
/home/sshuser/sqldump
databasename.sql
/var/www/html
Remote Server Html Files will be Copied to Localhost /var/www/html
databasename.sql Backup will Done from Remote Server to localhost Server Backup Path /home/sshuser/sqldump
databasename.sql will Restore in localhost Database

Phpmyadmin for CentOS


PHPMyadmin :
——————
phpMyAdmin is an open source tool used for the administration of MySQL. In addition to offering the capability to perform administration tasks such as creating, editing, or deleting databases, and managing users and permissions, phpMyAdmin provides a graphical user interface to do all of these tasks

Features of phpMyAdmin :
———————————
1) Friendly web interface
2) Supported most of the MySQL features
3) Browse and drop databases, tables, views, fields and indexes.
4) Create, copy, drop, rename and alter databases, tables, fields and indexes
5) Manage MySQL users and there privileges
6) Import data from CSV and SQL
7) Administering multiple servers

Output Details :
——————-
Output –> http://IP-Address/phpmyadmin

Manual Installation :
————————-
yum -y update

yum -y install phpmyadmin

service httpd restart

Phpmyadmin Script for CentOS :
—————————————–
#!/bin/bash

echo “Add the EPEL Repository”

rpm -iUvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

echo “Updating Packages”

yum -y update

echo “Install phpMyAdmin”

yum -y install phpmyadmin

echo “Re-Starting Apache Service”

service httpd restart

echo “Installation is Completed”

echo -e “Please check with http://Ip-address/phpmyadmin&#8221;

echo -e “Login Details: Use MySQL Username & Password”