第十八周学习笔记

数据库日志备份还原

一种方法为还原表数据,使用select----into outfile--- 命令成功备份表数据后,产生的副本文件是指定格式的文本文件,该文本文件中仅仅包含 表记录信息

1.首先把银行账户account 表中的记录导出到acoumt.ut 文本文件,然后使用delete全今利除acot 表中的所有记录(避免自增字段值重复),最后使用load data infle 命令将acoOmtD文本文件中的数据导入到account 表中。

2.将MySQL 客户机中的acomt.ut 文本文件中的数据导入到IP 地址192 168.1.104 的MySQL 服务器的choose 数据库的accomt 表中。

load data local infile 'account.txt' into table fields terminated by '|' optionally enclosed by '"' optionally enclosed by '"' lines terminated by ' ' set account_no=account_no +100;

代码如上

 

load data infile   能够快速的从一个指定格式的文本文件中读取数据到一个数据库表中

原文地址:https://www.cnblogs.com/lzy35/p/8179973.html