大きなxlsx(スプレッドシートファイル)をmysqlデータベースにインポートしたいと思います。以前にphpmyadminで実行しましたが、このファイルは大きすぎます(205000行)。
ですから、phpmyadminでやりたいと思ったら、時間がかかり、できませんでした。
それをmysqlデータベースにインポートするための最良かつ高速な方法は何ですか?
大きなxlsx(スプレッドシートファイル)をmysqlデータベースにインポートしたいと思います。以前にphpmyadminで実行しましたが、このファイルは大きすぎます(205000行)。
ですから、phpmyadminでやりたいと思ったら、時間がかかり、できませんでした。
それをmysqlデータベースにインポートするための最良かつ高速な方法は何ですか?
LOAD DATA
MySQLのコマンド
を使用してそれを行うことができます:http: //blog.tjitjing.com/index.php/2008/02/import-excel-data-into-mysql-in-5-easy.html
Save your Excel data as a csv file (In Excel 2007 using Save As) Check the saved file using a text editor such as Notepad to see what it actually looks like, i.e. what delimiter was used etc. Start the MySQL Command Prompt (I usually do this from the MySQL Query Browser – Tools – MySQL Command Line Client to avoid having to enter username and password etc.) Enter this command: LOAD DATA LOCAL INFILE ‘C:\\temp\\yourfile.csv’ INTO TABLE database.table FIELDS TERMINATED BY ‘;’ ENCLOSED BY ‘”‘ LINES TERMINATED BY ‘\r\n’ (field1, field2); [Edit: Make sure to check your single quotes (') and double quotes (") if you copy and paste this code] Done!
Navicat MySQL を試すことができます。私は 250MB 以上の xlsx ファイルでこれを行いましたが、Navicat は汗をかくことなく完璧に処理します。
あなたのMySQLが大量のデータを受信できるように設定されていることを確認してmax_allowed_packet
くださいmy.ini
。
Toad for MySQL (フリーウェア) も別の選択肢です。