mysql - 如何将具有 188 万行的 .csv 文件中的数据导入 MySQL
问题描述
我正在尝试将以下链接中的数据加载到 MYSQL 数据库方案中
点击这里
但它在 30 秒后超时
我已经使用代码将时间设置为 1000 秒。但它仍然不起作用
show variables like "net_read_timeout"
set net_read_timeout = 1000;
我应该如何将 188 万行加载到我的架构中
解决方案
LOAD DATA INFILE
is your solution. You can read the documentation from the MySQL website and generate the LOAD DATA query for your need. Make sure you put the file in a place where MySQL process can read. It can only load files from certain location. Again it is part of the documentation.
https://dev.mysql.com/doc/refman/8.0/en/load-data.html
LOAD DATA INFILE '/tmp/test.txt' INTO TABLE test FIELDS TERMINATED BY ',' LINES STARTING BY 'xxx';
推荐阅读
- vba - Excel VBA 过滤被忽略
- dart - Flutter中文本字段中的文本垂直居中
- python - Python3比较两个列表并找到通配符匹配
- javascript - jscodeshift 总是跳过我的 js 文件
- php - PHP 网页未连接到其他设备上的 SQL 服务器
- decision-tree - 计算 ID3 树的性能
- openstack - 您如何将 DC/OS 部署到 openstack 上?
- python-3.x - 此代码用于聊天程序,帮助我使其在不同的笔记本电脑上工作
- javascript - 在后台将文件上传到 Firebase 存储
- angular - 将 scss 文件从 src/assets/ 导入组件 scss 文件