MySQL has a CSV storage engine.
I'm wondering if I could create such a table directly from an existing CSV file.
Made up command as example:
CREATE TABLE test (i INT NOT NULL, c CHAR(10) NOT NULL) ENGINE = CSV FROM FILE /file;
What I'm trying to achieve is an efficient way to load data that doesn't depend on LOAD DATA
as that command opens up the possibility of arbitrary command execution.
Best Answer
Here is something a MySQL Daredevil is more than willing to try.
I just did the following in MySQL 5.6.14 right on my Laptop
Now, going into the OS:
As show in the above commands in mysql and in the Windows command line, the CSV file that mysql can handle has the following two characteristics:
Since you created the test table as CSV, here is what you should do:
test
in your datadir.FLUSH TABLES;
Afterwards, the table shold be fully accessiable.
CAVEAT (Windows)
If Windows has the CSV table locked, run these commands
test
in your datadir.net stop mysql
net start mysql
Give it a Try !!!