In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
Full backup of data
Mysqldump-uroot-pabc123-- databases school > / opt/school.sql
Delete Library
Mysql > drop database school
View the database
Mysql > show databases
+-+ | Database | +-+ | information_schema | | mysql | | performance_schema | | sys | +-+ restore database
Mysql > source / opt/school.sql
Mysql > show databases; # View database confirmation
+-+
| | Database |
+-+
| | information_schema |
| | mysql |
| | performance_schema |
| | school |
| | sys |
+-+
Method 2: this method needs to recreate the library name
Mysqldump-uroot-pabc123 school > / opt/school.sql
Mysql > create database school
Mysql > source / opt/school.sql
Mysql > show tables
+-+
| | Tables_in_school |
+-+
| | info |
+-+
1 row in set (0.00 sec)
Mysql > select * from info
+-- +
| | id | name | score | |
+-- +
| | 1 | ll | 88 | |
| | 2 | tl | 68 | |
| | 3 | ww | 44 | |
| | 4 | pw | 55 | |
+-- +
Method 3: do not enter the mysql database to recover data
Mysql-uroot-pabc123
< /opt/school.sql 数据表备份 mysqldump -uroot -pabc123 school info \>/ opt/info.sql
Delete table (simulate data table corruption)
Mysql > drop table info
Restore backup data table
Mysql\ > source / opt/info.sql
View form
Mysql > show tables
+-+
| | Tables_in_school |
+-+
| | info |
+-+
Like a database, you can recover data tables without logging in to mysql
Mysql-uroot-pabc123 school
< /opt/info.sql 总结: 无论是恢复数据库还是恢复数据表,都应该先查看一下备份文件,看里面有无自动创建数据库或数据表的命令,再考虑是否在备份时创建数据库和数据表! 查看备份文件 vim school.sqlWelcome 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.