In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following is about the method of full backup and recovery of Mysql database. The secret of the text lies in being close to the topic. So, no gossip, let's read the following directly, I believe you will benefit from reading this article on how to achieve full backup and recovery of Mysql database.
The importance of database backup improves the high availability and disaster recoverability of the system. When the database system crashes, it is impossible to find data without data backup. Using database backup to restore database is the best way to provide the minimum cost of data recovery when the database crashes. There is no database, there is nothing, database backup is a powerful means to prevent disasters. 1. Full physical backup 1.1 when backing up database compression using the tar package folder, the xz format compression with a higher compression ratio is used. Rpm-Q xz / / check whether the xz package installs yum-y install xz / / install the xz package 1.2 to compress the database folder / usr/local/mysql/data/ package tar Jcvf / opt/mysql-$ (date +% F) .tar.xz / usr/local/mysql/data/ back up the database folder and name 1.3 in the form of year, month and day if the database file is lost You can extract the backup file to restore tar Jxvf / opt/mysql-2018-08-01.tar.xz / usr/local/mysql/data/2. Use mysqldump tool backup 2.1 to back up a database mysqldump-u root-p [password] [option] [database name] [table name] > / backup path / backup file name / / backup library to the directory. If you don't write, enter your password to verify it after you enter. Backup files are all suffixed with .sql, 2.2 create a database school The info1 of the school library, Info2 table backup mysqldump-u root-p123123 school info1 info2 > / opt/info.sql 2.3 backup multiple databases mysqldump-u root-p-- databases mysql stady > / opt/mysql-stady.sql2.4 backup all databases mysqldump-u root-p-- opt-- all-databases > / opt//all.sql2.5 backup table mysqldump-u root-p stady info > / opt/stady-info.sql 2.6 backup data Mysqldump-u root-p-d stady info > / opt/decribe-info.sql / /-d library name + table name 3. Restore Database 3.1 Log in to Mysql restore drop database school; / / first delete the corrupted school library source / opt/school.sql use the mysql command to restore drop database school; / / log in to mysql to delete the corrupted school library create database school; / / then recreate the library exit / / exit mysql mysql-u root-p123123 school < / opt/school.sql 3.2 restore table operation and restore database the same mysql-u root-p stady < / opt/stady-info.sql
However, when restoring the data table, it should be noted that if only the table file is backed up in the backup file, and there is no library in the mysql, the direct restore will fail, and the library must be created first and then restored.
For the above Mysql database to achieve full backup and recovery methods related to the content, is there anything you do not understand? Or if you want to know more about it, you can continue to follow our industry information section.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.