In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
How to back up and restore MySQL database? This problem may be often seen in our daily study or work. I hope you can gain a lot from this question. The following is the reference content that the editor brings to you, let's take a look at it!
MySQL is a database server that permanently stores data. If you use MySQLServer, you need to create a database backup to recover from a crash. Mysql provides a utility, mysqldump, for backup.
Options for creating MySQL database backups
There are many ways to create database backups. For this example, we use the database name "mydb".
1. Full database backup in a normal .sql file
# mysqldump-u root-p mydb > mydb.sql
two。 Archive the full database backup in the .sql.gz file
# mysqldump-u root-p mydb | gzip > mydb.sql.gz
3. Back up only a single table
# mysqldump-u root-p mydb tbl_student > tbl_student.sql
4. Back up multiple databases
# mysqldump-u root-p-- databases mydb1 mydb2 mydb3 > mydb1-mydb2-mydb3.sql
5. Back up all databases
# mysqldump-u root-p--all-databases > all-db-backup.sql
6. Back up only the database structure (no data)
# mysqldump-u root-p--no-datamydb > mydb.sql
7. Backup only database data (no table structure)
# mysqldump-u root-p--no-create-infomydb > mydb.sql
8. Back up the MySQL database in XML format
# mysqldump-u root-p-- xml mydb > mydb.xml
How do I restore an MySQL backup?
Restoring a database from a backup is very simple. We use the mysql command. For example, the following command restores all backups from mydb.sql to the mydb database.
# mysql-u root-p mydb
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.