数据库常用相关操作:
一、导入导出数据
方法一:
1.导出查询结果:select语句 into outfile '保存路径+文件名'
2.导入查询结果:load data local infile '保存路径+文件名' into table 表明 character set utf8;
3.导入查询结果:将格式化文件导入mysql表:mysqlimport [options] db_name textfile1 [textfile2 ...] 详见:https://dev.mysql.com/doc/refman/5.7/en/mysqlimport.html
4.导入查询结果:source命令:source '文件路径+文件名' 详见:https://dev.mysql.com/doc/refman/5.7/en/mysql-batch-commands.html
方法二:
导出查询结果:
1.mysqldump命令:mysqldump [options] > dump.sql 详见:https://dev.mysql.com/doc/refman/5.7/en/mysqldump.html