Can I create a dynamic MySQL database from a .CSV?
adam4668
2015-07-02 12:11:06 UTC
I created a MySQL database using phpmyadmin and imported my data from a csv file. The only problem is that I want to be able to update the csv, and automatically have the MySQL database update along with it. How can I do this?
Five answers:
Jeff P
2015-07-02 19:47:21 UTC
It seems like the best thing to do would be to work directly from the database and not the CSV file.
But, if you must, simply put the CSV file in a location accessible to the MySQL server and just import it on a regular basis using a scheduled task (or Cron job). You would probably want to delete everything in the tables first before importing them so you don't get duplicates.
2015-07-02 13:03:13 UTC
What a waste of a good database. Once you import data you are better to use strictly mysql.
Effectual David
2015-07-02 21:53:43 UTC
You can not have changes done automatically to database by just updating a .csv file.
You need to import it every time whenever you make any changes.
?
2015-07-02 12:30:03 UTC
I guess you could have a script run to re-import the CSV file either on demand or on a timer.
AJ
2015-07-02 12:53:49 UTC
The only way to do that is to truncate the table and then re import the csv into the table.
there is no automatic way to do that.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.