当前位置:网站首页>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’;
边栏推荐
猜你喜欢
Execution failed for task ‘:xxx:generateReleaseRFile‘.
CCF GLCC正式开营|九州云开源专家携丰厚奖金,助力高校开源推广
《社会企业开展应聘文职人员培训规范》团体标准在新华书店上架
"C pitfalls and pitfalls" reading summary
如何才能有效、高效阅读?猿辅导建议“因材因时施教”
【硬件架构的艺术】学习笔记(1)亚稳态的世界
开发者独立搭建一个跨模态搜索应用有多难?
SLAM 04.视觉里程计-1-相机模型
化繁为简,聊一聊复制状态机系统架构抽象
Button control switch 4017 digital circuit chip
随机推荐
[机缘参悟-60]:《兵者,诡道也》-1-开篇:“死“与“生“都是天道
浙江大学团队使用基于知识图谱的新方法,从空间分辨转录组数据中推断细胞间通信状况
MySQL【窗口函数】【共用表表达式】
SLAM 04.视觉里程计-1-相机模型
leetcode 48. Rotate Image (Medium)
CF1527D MEX Tree(mex&树&容斥)
2546 饭卡(01背包,挺好的)
ACL 2022 | 社会科学理论驱动的言论建模
快解析结合千方百剂
leetcode 48. Rotate Image 旋转图像(Medium)
VBS函数应用–getobject的使用获得Automation对象
华为手机切换屏幕效果_华为p40页面切换效果怎么换
Problem solving-->Online OJ (18)
AVR学习笔记之熔丝位
How to play the Tower of Hanoi
【无标题】
"C pitfalls and pitfalls" reading summary
Lixia Action | Kyushu Yunzhang Jinnan: Open source is not a movement for a few people, popularization is the source
电子行业MES管理系统有哪些特殊功能
【HMS core】【Media】【视频编辑服务】 在线素材无法展示,一直Loading状态或是网络异常