MySQL database backup and recovery implementation code

MySQL database backup and recovery implementation code

Database backup

#grammar:
# mysqldump -h server-u username-p password database name> backup file.sql

#Example:
#Single database backup mysqldump -uroot -p123 db1 > db1.sql
mysqldump -uroot -p123 db1 table1 table2 > db1-table1-table2.sql

#Multi-database backup mysqldump -uroot -p123 --databases db1 db2 mysql db3 > db1_db2_mysql_db3.sql

#Backup all librariesmysqldump -uroot -p123 --all-databases > all.sql

Data Recovery

#Method 1:
[root@egon backup]# mysql -uroot -p123 < /backup/all.sql

#Method 2:
mysql> use db1;
mysql> SET SQL_LOG_BIN=0; #Turn off binary logging, only effective for the current session mysql> source /root/db1.sql

The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM.

You may also be interested in:
  • How to restore data using binlog in mysql5.7
  • MySQL restores data through binlog
  • MySQL uses frm files and ibd files to restore table data
  • MySQL uses binlog logs to implement data recovery
  • Implementation of mysql using mysqlbinlog command to restore accidentally deleted data
  • Two methods of restoring MySQL data
  • MySQL uses mysqldump+binlog to completely restore the deleted database principle analysis
  • Analysis of MySQL data backup and recovery implementation methods
  • MySQL Binlog Data Recovery: Detailed Explanation of Accidentally Deleting a Database
  • Summary of various methods of MySQL data recovery

<<:  Detailed tutorial on docker-compose deployment and configuration of Jenkins

>>:  How to install Nginx in a specified location in Centos system

Recommend

How to implement image mapping with CSS

1. Introduction Image maps allow you to designate...

Example steps for using AntV X6 with Vue.js

Table of contents 0x0 Introduction 0x1 Installati...

MySQL 5.7.16 free installation version graphic tutorial under Linux

This article shares the MySQL 5.7.16 free install...

Search engine free collection of website entrances

1: Baidu website login entrance Website: http://ww...

MySQL Series 11 Logging

Tutorial Series MySQL series: Basic concepts of M...

Vue implements login type switching

This article example shares the specific code of ...

Detailed explanation of JavaScript's Set data structure

Table of contents 1. What is Set 2. Set Construct...

This article will show you how to use Vue 3.0 responsive

Table of contents Use Cases Reactive API related ...

Vue2.x - Example of using anti-shake and throttling

Table of contents utils: Use in vue: explain: Ima...

JS implements multiple tab switching carousel

Carousel animation can improve the appearance and...

Detailed explanation of the use of this.$set in Vue

Table of contents Use of this.$set in Vue use Why...