Home PC Games Linux Windows Database Network Programming Server Mobile  
  Home \ Database \ mysqldump implement database logical backup     - Linux FAQ - How to fix tar:Exitingwith failure status due to previous errors (Linux)

- Ubuntu 14.04 LTS 64-bit install GNS3 1.3.7 (Linux)

- Compare Several MySQL environmental issues (Database)

- To install Samba server on CentOS 6.6 (Server)

- How to configure SNMPv3 on Ubuntu, CentOS and Cisco systems (Linux)

- Hadoop namenode do NFS disaster recovery (Server)

- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (Linux)

- Tomcat installation under Linux (Server)

- Use Ansible efficient delivery Docker container (Server)

- By creating a personal technology blog Detailed GitHub (Linux)

- Advanced Search Oracle study notes (Database)

- Computer security perimeter recommendations (Linux)

- OpenWRT environment to build (Linux)

- OpenStack / Dev stack with neutron on Ubuntu 14.04 (Server)

- Hibernate + JUnit test entity class generate database table (Programming)

- Docker startups use continuous integration deployment (Server)

- ThinkPad X201i installation notes Debian 7.5 (Linux)

- Oracle archive log summary (Database)

- Let the terminal under Mac OS X as like Linux has displayed a variety of colors (Linux)

- Struts2 study notes -Valuestack (value stack) and OGNL expression (Programming)

  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.
- Android shutdown (reboot) process (Programming)
- Automated Password Generator: Linux under a special password generator (Linux)
- Android thread mechanism --AsyncTask (Programming)
- Linux common commands ll namely ls -l --color = auto (Linux)
- MySQL optimization tabs (Database)
- Oracle query start with connect by tree (Database)
- Oracle metadata Reconstruction experiments (Database)
- Make Linux more secure server tips (Linux)
- Spring inject a type of object to enumerate (Programming)
- How to install OpenOffice Ubuntu or Linux Mint (Linux)
- Elaborate .NET Multithreading: Using Task (Programming)
- Use innobackupex full realization of MySQL hot backup (Database)
- Getting Started with Linux system to learn: how to install autossh (Linux)
- Linux set the maximum number of open files nofile and nr_open, file-max Description (Linux)
- Ubuntu 12.04 kernel configuration automatically restart and crash dump (Linux)
- How to install web crawler tool in Ubuntu 14.04 LTS: Scrapy (Linux)
- Linux under DB2SQL1024N A database connection does not exist. SQLS (Database)
- Spacewalk remove packages install the update (Linux)
- Oracle 10g relations with the constraint of column properties NULLABLE (Database)
- 4 lvcreate example commonly used commands (Linux)
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.