Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Database \ Under CentOS Linux automatic backup MySQL database daily     - Let CentOS6 yum upgrade to support more source rpm package (Linux)

- CentOS set up FTP server (Server)

- The difference between equals and == in Java (Programming)

- Oracle Database asynchronous IO cause slow query response (Database)

- Modular JavaScript (Programming)

- Zookeeper cluster deployment (Server)

- Learning UNIX good habits (Linux)

- Android in the coordinate system and a method to obtain the coordinates (Programming)

- Java NIO2: Buffer (Programming)

- CentOS 6.x Basic System Optimization after installation (Linux)

- open V switch port mirror in OpenStack neutron (Server)

- BusyBox build root file system (Linux)

- Taught you how to build your own VPS server (Server)

- OpenGL Programming Guide (8th edition of the original book) - compute shader (Programming)

- ApacheDS configuration of users and user groups to achieve SSO (Server)

- VirtualBox virtual machine to install Linux (Linux)

- Oracle Character Set Summary (Database)

- Linux server operating system security configuration (Linux)

- Compare several ways to transfer files between Linux hosts (Linux)

- Spring3 + SpringMVC + Hibernate4 full annotation environment configuration (Server)

 
         
  Under CentOS Linux automatic backup MySQL database daily
     
  Add Date : 2018-11-21      
         
         
         
  Under CentOS Linux automatic backup MySQL database daily

1. First built in the server folder the following three folders: mkdir / bak, mkdir / bak / bakmysql, mkdir / bak / bakmysqlold. In / bak / bakmysql folder to build a shell script: touch /bak/bakmysql/backup.sh.

Authorization to file: chmod 755 /bak/bakmysql/backup.sh.

2. Edit the shell script: vi /bak/bakmysql/backup.sh
#! / Bin / sh
cd / bak / bakmysql
echo "You are in bakmysql directory"
mv bakmysql * / bak / bakmysqlold
echo "Old databases are moved to bakmysqlold folder"
Now = $ (date + "% d-% m-% Y")
File = bakmysql- $ Now.sql
mysqldump -uroot -p'password 'db_bbs> $ File
echo "Your database backup successfully completed"
SevenDays = $ (date -d -7day + "% d-% m-% Y")
if [-f /bak/bakmysqlold/bakmysql-$SevenDays.sql]
then
rm -rf /bak/bakmysqlold/bakmysql-$SevenDays.sql
echo "You have delete 7days ago bak file"
else
echo "7days ago bak file not exist"
fi

3.shell script: mysqldump -uroot -p'password 'db_bbs> $ File phrase in red font please change are your mysql database user, password, and database name. Script first folder / bak / bakmysql bakmysql file name for the backup file moves to the beginning / bak / bakmysqlold, then generate the most recent backup file, and finally determine / bak / bakmysqlold Folder file seven days before and whether there then delete the last end. This will automatically backup the last seven days of database scripts.

4. Set up automatic daily execution shell script: vi / etc / crontab in add the following line (please reference the specific meaning / etc / crontab in comments): 0 0 * * * root /bak/bakmysql/backup.sh. Restart crontab: / sbin / service crond restart. If not set to boot from the start crontab can boot from the start of their set as follows: chkconfig -level 35 crond on
     
         
         
         
  More:      
 
- Linux how to view the graphics models notebook (Linux)
- Sublime Text 3 (Linux)
- The best tools and techniques to find data on a Unix system (Linux)
- ImportTsv-HBase data import tool (Database)
- Using Java to build micro-services (Server)
- Java in the inverter and covariance (Programming)
- Ubuntu 14.04 compile and install Apache (Server)
- You must ask yourself four questions before deploying Docker (Server)
- Linux operating system security management skills notes (Linux)
- Spring MVC Exception Handling (Programming)
- Use Mop monitor stock prices at the Linux command line (Linux)
- Archive log file size and redo log file size relationship (Database)
- PLSQL Developer synchronization table tools (Database)
- Eclipse-4.4 crash problem solving under Debian-7.6 (Linux)
- Python pickle module for simple use notes (Programming)
- CentOS 5.x install Lua 5.2.3 error (LIBS = -lncurses) (Linux)
- CentOS x86 64bit upgrade to 2.7 Python2.6 (Linux)
- Java and Python use make way dictionary word search script (Programming)
- Use web2py + uWSGI + Nginx Web server built on Linux (Server)
- Use smartmontools view the health status of hard disk (Linux)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.