Using the CSV storage engine to import data
After defining a CSV table, you can replace the CSV file. For that, you need to run the FLUSH TABLE <table>
command to ensure that the server rereads this and then the data is available. Having the data in a CSV table, however, is probably not the endpoint you want to get to, as it doesn't support indexing or primary keys. So, the next step would be to use the following:
"INSERT INTO <new_table> SELECT * FROM <csv_table>"
Alternatively, you can run the following:
'ALTER TABLE <csv_table> ENGINE=InnoDB'
Either of the options can be used to convert the table to InnoDB. Once this is done, you should define a primary key and add indexes if needed. Let's see an exercise where we will make use of the CSV storage engine to import data.
Note
On Windows, always start the MySQL command-line client via the MySQL Command Line Client – Unicode entry. Non-Unicode causes text...