当前位置:网站首页>Database recovery
Database recovery
2022-08-04 14:16:00 【ink_】
备份
表结构
首先,Enter in the directory where the file is to be storedcmd,Press Enter to enter the command line for operating the directory
After entering the command line
mysqldump命令 备份文件
Note here that my original database name isjx_db
because of special symbols_Therefore, an error that the database cannot be found will be reported during backup,So I copied this database named jxdbnormal backup!
mysqldump -u root -p jxdb > jxdb_bk_20211205.sql
mysqldump -u root -p jxdb student> student_bk.sql


恢复
Recovery here is what I usemysql source命令 As for how to use the other directlymysql -uroot I failed with such command…不知道为啥
原表为
删除一行:
有外键约束,The foreign key constraint must be closed before it can be deleted normally
SET FOREIGN_KEY_CHECKS = 0 ;
DELETE FROM student WHERE sno = 15202101;

恢复student表:
use jxdb;
source X:\ProgramData\SqlBackUp/student_bk.sql

恢复成功!
Note that we do not need to log in when we back upmysql的,
When backing up, you can directly perform command line operations in the directory, but you must log in first when restoringmysql,Restore used heresourcecommand and specify the database
导出
SELECT * FROM sc INTO OUTFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/SC_out.txt';
导出时报错:The MySQL server is running with the --secure-file-priv option so it cannot execute this statement
The reason for the error was found to be the installationmysqlSecurity permissions are restricted,这个选项设置系统变量: secure_file_priv,这个变量被用于限制数据导入的导出操作
用SHOW VARIABLES LIKE “secure_file_priv”;Check out our file paths

解决方案
解决办法
将文件导入到value的目录下 并且要注意sqlUse slashes in statements\才可以!
SELECT * FROM sc INTO OUTFILE 'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/SC_out.txt';

导入
报错:Loading local data is disabled; this must be enabled on both the client and server sides
Check to see if import permission is turned on
SHOW GLOBAL VARIABLES LIKE 'local_infile';

change this value to ON,在mysql客户端输入:
set global local_infile=1;

Specify the original path to the file import table!
成功!
LOAD DATA LOCAL INFILE
'C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/SC_out.txt'
INTO TABLE sc

也可以导出为html
SELECT * FROM course INTO OUTFILE
‘C:/ProgramData/MySQL/MySQL Server 8.0/Uploads/course_html.html’;
边栏推荐
猜你喜欢

State security organs conduct criminal arrest and summons review on Yang Zhiyuan, a suspect suspected of endangering national security

Button control switch 4017 digital circuit chip

How to play the Tower of Hanoi

Theory 1: Deep Learning - Detailed Explanation of the LetNet Model

数据库恢复

快解析结合友加畅捷U+

CCF GLCC正式开营|九州云开源专家携丰厚奖金,助力高校开源推广

Crawler - basic use of selenium, no interface browser, other uses of selenium, cookies of selenium, crawler cases

从理论到实践:MySQL性能优化和高可用架构,一次讲清
![[LeetCode] 38. Appearance sequence](/img/d6/092796b57844d5d30f3ed123a1b98a.png)
[LeetCode] 38. Appearance sequence
随机推荐
Fuse bit of AVR study notes
SLAM 05.视觉里程计-2-特征法
leetcode 48. Rotate Image (Medium)
将 Sentinel 熔断限流规则持久化到 Nacos 配置中心
如何确定异步 I/O 瓶颈
Almost all known protein structures in the world are open sourced by DeepMind
如何在ubuntu环境下安装postgresql并配置远程访问
国家安全机关对涉嫌危害国家安全犯罪嫌疑人杨智渊实施刑事拘传审查
秋招攻略秘籍,吃透25个技术栈Offer拿到手软
浙江大学团队使用基于知识图谱的新方法,从空间分辨转录组数据中推断细胞间通信状况
How to play the Tower of Hanoi
nVisual secondary development - Chapter 2 nVisual API operation guide Swagger use
从理论到实践:MySQL性能优化和高可用架构,一次讲清
[深入研究4G/5G/6G专题-50]: URLLC-16-《3GPP URLLC相关协议、规范、技术原理深度解读》-10-高可靠性技术-1-低编码率编码调制方案MCS与高可靠性DRB
数据库的基本概念
快解析结合千方百剂
ACL 2022 | 社会科学理论驱动的言论建模
橄榄枝大课堂APP正式启动上线
卷积神经网络 基础
idea永久激活教程(新版)