Get the App
SLTechnology News&Howtos  ›  Servers  › 

Simple Operation of mysql data backup and recovery

Shulou Source: shulou.com Published: 2022-06-03 06:26:40 10月03日 Update

This article mainly tells you about the simple operation of mysql data backup and recovery. You can check the relevant professional terms on the Internet or find some related books to supplement them. We will not dabble here. Let's go straight to the topic. I hope this article on the simple operation of mysql data backup and recovery can bring you some practical help.

Physical backup

Tar jcvf / opt/ `date +% x`mysql.tar.gz / usr/local/mysql/data

Full backup of a single library

Mysqldump-u root-p 'password' auth > / opt/auth.sql

Mysqldump-u root-p 'password' mysql > / opt/mysql.sql

Make a full backup of multiple libraries

Mysqldump-u user name-p [password] [option]-- databases library name 1 [library name 2]. > / backup path / backup file name

Mysqldump-U root-p-- databases demo mysql > / opt/databases-demo-mysql.sql

Make a full backup of all libraries

Mysqldump-u user name-p [password] [option]-- all-databases > / backup path / backup file name

Mysqldump-u root-p-- opt-- all-databases > / opt/all-data.sql

Mysqldump backup table

Mysqldump-u user name-p [password] [option] Database name Table name > / backup path / backup File name

Mysqldump-U root-P mysql user > / opt/mysql-user.sql

Restore the database

MySQL [(demo)] > source / opt/all-data.sql

Restore Database 2

Mysql-u user name-p [password] [library name]

Tags: Backup password data user user name path file data backup database file name specialty script industry expertise subject book location content single incremental Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno OPPO Reno Docker MySQL Shulou Tech Info Shulou Information