Creat Backup of MYSQL (Ubuntu 14.04)


                ----------------------------------------------------------------------------
                Bakup/Main server 192.168.5.227        |        restore server 13.71.117.185
                ----------------------------------------------------------------------------

(192.168.5.227)                                                              
----------------------------------------------------------------------------          
Create Backups of an Entire DBMS Using Copies of the MySQL Data Directory
----------------------------------------------------------------------------          
                                              
STEP 1                                                  
----------------------------------------------------------------------------                  
Stop you mysql by below given commands                               
----------------------------------------------------------------------------          
#/etc/init.d/mysql stop                                      
Step 2                                              
----------------------------------------------------------------------------      
Use below commands to find out where is your mysql main directory like mine          
is here /var/lib/mysql                                      
----------------------------------------------------------------------------          
#find / -name mysql                                          
                                                  
                                              
STEP 3                                                          
-----------------------------------------------------------------------------                              
Create Directory where you want to keep backup file.. like mine /opt/backup
-----------------------------------------------------------------------------
#mkdir /opt/backup

STEP 4
-----------------------------------------------------------------------------
Use below command to copy your mysql fies..
-----------------------------------------------------------------------------
#cp -R /var/lib/mysql/* /opt/backup

STEP 5
-----------------------------------------------------------------------------
Make tar/zip of your backup files
-----------------------------------------------------------------------------
#tar -zcvf backup.tar /opt/backup

STEP 6
-----------------------------------------------------------------------------
Copy your tar file on (192.168.5.228) In /opt directory
-----------------------------------------------------------------------------


(192.168.5.228)
STEP 1
-----------------------------------------------------------------------------
First change (mysql to mysqlold )your primary /var/lib/mysql
-----------------------------------------------------------------------------
#mv /var/lib/mysq /var/lib/mysqlold

STEP 2
-----------------------------------------------------------------------------
Creat new directory in /var/lib/mysql
-----------------------------------------------------------------------------
#mkdir /var/lib/mysql

STEP 3
-----------------------------------------------------------------------------
Give permission on your direcroty /var/lib/mysql
-----------------------------------------------------------------------------
#chown -R mysql:mysql /var/lib/mysql

STEP 4
-----------------------------------------------------------------------------
Past your backuped file here /var/libe/mysql after extract your tar file
-----------------------------------------------------------------------------
#mv /opt/backup/* /var/libe/mysql

here we done just start your mysql
#/etc/init.d/mysql start

#Arvind

Popular posts from this blog

Setup DHCP Server on Linux

Set Manually IP Address (Ubuntu 14.04) Desktop env.

How to set Java Path if you want to put your java any directory in linux Computer