Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Database \ mysqldump implement database logical backup     - Android graphic introduction NDK installation and simple jni demo implementation (Linux)

- Linux System Getting Started Learning: Change the name of the network interface on CentOS7 (Linux)

- Linux kernel IPv6 protocol closed manner (Linux)

- MySQL Tutorial: About checkpoint mechanism (Database)

- Mac OS X Server installation and application (Linux)

- FreeBSD install Gnome 3 Desktop (Linux)

- ASP.NET 5 is connected with the Redis server on the Linux platform (Server)

- Linux boot process and run level (Linux)

- PHP loop reference caused strange problems (Programming)

- Linux find command detailing (Linux)

- CentOS 6.5 installation configuration DRBD (Server)

- Tomcat itself through simple movement separation (Server)

- Using a proxy method under Linux terminal (Linux)

- 11.2.04 Oracle RAC directory crfclust.bdb file is too large, Bug 20186278 (Database)

- Server Security Analysis attack on Linux (Linux)

- C # using the HttpClient Note: Preheat the long connection (Programming)

- Nginx Load Balancing (standby) + Keepalived (Server)

- linux firewall configuration (Linux)

- Linux NIC configuration (Linux)

- Oracle large table to clean truncate .. reuse storage (Database)

  mysqldump implement database logical backup
  Add Date : 2018-11-21      
  Mysqldump is mysql tools used for logical backup. In the process of database backup, you need to include a backup, the database itself, data, binary files (used for database even point reduction).

Following is a brief introduction to the next.

Backup starts:

1: landing mysql process, will need to enter a password, enter the password each time if you want to avoid tedious, you can create .my.cnf hidden files in the login user's home directory to root user as an example

vi /root/.my.cnf


user = 'root'

password = 'exit'

host = 'localhost'

Again until landing time, landing mysql can directly enter the system.

2: Back up the database

mysql database connection

show master status; // that is used to view the current binary log file.

mysqldump -all-databases -lock-all-tables -flush-logs-master-data = 2> / root`date +% F-% H-% M-% S`.sql

Now the database backup, backup binary log file below, after the backup or data binary log files have been refreshed, says a new binary log file is generated, the file name is the serial number on a binary file plus one.

Binary log files will be backed up before the first flush

mysqlbinlog /data/mydata/mysql-bin.000005> /root/1.sql

mysql database connections increment

use stu;

insert into score (name, score) values ( 'xiaozhang', 96);

select * from score;


One day after the last incremental backup

mysqlbinlog /data/mydata/mysql-bin.000006>/root/2.sql

3: Analog database damage.

cd / data / mydata

rm -rf *

killall mysqld // forced to close off all the processes mysql.

Re-initialize the database

cd / usr / local / mysql

scripts / mysql_install-db --user = mysql -datadir = / data / mydata

Before it restores the database to connect to mysql, the binary log file function off.


set sql_log_bin = 0 // Binary logging does not need to open the database restore process.


mysql < / root / `date +% F-% H-% M-% S`.sql // just backed up the database.

mysql < /root/1.sql // import binary log files

mysql < /root/2.sql // import binary incremental backup files

The reduction is complete, the connection open mysql binary log function.


set sql_log_bin = 1

purge binary logs to 'mysql-bin.000006'; // delete No binary log file.

Well, mysqldump logic also previously said that. After continued.
- How to use the on-screen keyboard in Linux (Linux)
- Comparison of C # and Java (Programming)
- How do you turn on and off IPv6 address on Fedora (Linux)
- Spring Data MongoDB combat (Database)
- Using Linux command line and execute PHP code (Programming)
- Installation Enpass secure password manager on Ubuntu (Linux)
- CentOS 6.5 install Firefox (Linux)
- CentOS 7 How to connect to a wireless network (Linux)
- Oracle user lock how to know what causes (Database)
- Let OpenCV face detection score output codes (Programming)
- How to install the Ruby runtime environment on Mac OS X (Linux)
- MySQL flip-flop (Database)
- C language files update in real time (Programming)
- Formatted output printf command (Programming)
- Docker data container protection the pros and cons (Server)
- Using IntelliJ IDEA Import Spark Spark latest source code and compile the source code (Linux)
- HTML5 Application Cache (Programming)
- ORA-01000 Solution (Database)
- Use ldap implement Windows Remote Desktop Ubuntu Linux (Linux)
- Linux System Getting Started Learning: Linux common log file (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.