Import Large Amounts of Data to MySQL Quickly
Importing large amounts of data with SQL `INSERT` statements can take a long time. It's much faster to use MySQL's `LOAD DATA` statement. https://dev.mysql.com/doc/refman/5.7/en/load-data.html The data you upload must be in some CSV format; you can choose delimiters and escape characters. `LOAD DATA INFILE [filename] ...` will look for the file on the server where MySQL is running. Your MySQL user will need file permissions. MySQL is only allowed to read files on the server if they are in a certain directory. `LOAD DATA LOCAL INFILE [filename] ...` will look for the file on the machine that has connected to the MySQL instance. There is no restriction on where the file must be stored so long as your OS user has permission to read it. `LOAD DATA LOCAL` will only execute if you connected to MySQL with the `--secure-file-priv` option. i.e. `mysql -h [hostname] -u user -p db --secure-file-priv` DBMSes other than MySQL hopefully have a similar feature.