Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Summary of basic knowledge of disaster recovery in MySQL Database

2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "the summary of the basic knowledge of disaster preparedness in MySQL database". The content of the explanation in this article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn the basic knowledge summary of disaster preparedness in MySQL database.

1. Shortcut to data backup

Since this method has not been verified by official documents, let's call it an experiment.

Purpose: to back up a MySQL database in the hostA host, back up the TestA, and restore it to the hostB machine

Test environment:

Operating system: WinNT4.0,Mysql3.22.34,phpMyAdmin 2.1.0

Install MySQL database backup and establish TestA database in hostA

Host B machine installs MySQL database backup, no TestA database

Methods and steps:

Start phpMyAdmin to view the list of databases in HostA and HostB. There is no TestA database in HostB.

Locate the installation directory for MySQL database backup in HostA, and find the database directory data

In my experimental environment, this directory is C:\ mysql\ data

Find the subdirectory C:\ mysql\ data\ TestA of the corresponding database name

Paste and copy to the Data directory of HostB. The HostA is the same as the files in the backup data directory of the HostB MySQL database.

Refresh the phpMyAdmin of HostB and take a look at the database list. We can see that TestA has appeared, and the operations such as query modification are normal, and the backup recovery is successful.

Conclusion: the database of MySQL can be saved, backed up and restored in the form of files, as long as the corresponding file directory is restored, and there is no need to use other tools to back up.

Second, formal methods (official recommendations):

To export the mysqldump tool to use for MySQL database backup, the basic usage is:

Mysqldump [OPTIONS] database [tables]

If you do not specify any tables, the entire database will be exported.

By executing mysqldump-help, you can get a list of options supported by your version of mysqldump.

Note that if you run mysqldump without the-quick or-- opt option, mysqldump will load the entire result set into memory before exporting the results, which may be a problem if you are exporting a large database.

Mysqldump supports the following options:

-- add-locks

Add LOCK TABLES before each table is exported and then UNLOCK TABLE. (for faster insertion into MySQL database backups).

-- add-drop-table

Add a drop table before each create statement.

-- allow-keywords

Allows you to create column names that are keywords. This is done by adding the table name before the column name.

-c,-- complete-insert

Use the full insert statement (with column names).

-C,-- compress

If both the client and the server support compression, compress all the information between them.

-- delayed

Insert a row with the INSERT DELAYED command.

-e-- extended-insert

Use the new multiline INSERT syntax. (give more compact and faster insert statements)

-#,-- debug [= option_string]

Track the use of the program (for debugging).

-- help

Displays a help message and exits.

Thank you for your reading. The above is the content of "basic knowledge Summary of MySQL Database disaster Preparedness". After the study of this article, I believe you have a deeper understanding of the basic knowledge summary of MySQL Database disaster Preparedness, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Network Security

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report