导出命令:
mysql --default-character-set=utf8 -u账号 -p"密码" -e"select * from pharmacy.lwl_storage_codes">路径/导出的文件;
例如:
mysql --default-character-set=utf8 -upharmacy -p"root" -e"select * from pharmacy.lwl_storage_codes">/www/backup/name.txt;
备注:
导出 'txt文件' 每个字段用 '空格' 区分,每条数据用 '回车' 区分
导入数据
1. 登录:
mysql -u root -p --local-infile
2. 登录mysql:
use database(你要操作的数据库);
3. 导入命令:
load data local infile 'txt 文件地址'
into table 表名
fields terminated by '\t'
lines terminated by '\n'
ignore 1 lines
(字段1,字段2);
例如:
load data local infile '/var/lib/mysql/name.txt'
into table codes
fields terminated by '\t'
lines terminated by '\n'
ignore 1 lines
(id,pid,storage_id,tag,pzwh,file_id,is_out,code,created_at,updated_at,deleted_at);