Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    St. Louis, MO/Austin, TX

    flat file -> mysql db dynamically

    I'm using a red hat linux system, and i have a flat file that i want to be automatically updated into a mysql database on a regular basis (every 10-15 mins)...

    writing straight to the database isn't an option, it has to first go into this text file before being added to the db...

    how would you go about creating some form of script that will run itself and update the mySQL db as neccesary from this flatfile...

    the table is 4 columns wide and the file is ':' delimited.

    Thanks for advice... i'm really stuck on how to get from point a to point b... once i figure that out coding it shouldn't be too hard.

  2. #2
    Piece of cake

    Probably the easiest way to do this is to have the mysql client installed on the system. Then, you dont need anything more to do it.

    You will want to run this from cron via cronjob at the intervals you mentioned (goggle for directions if you dont know how, its easy).

    As an alternate approach, you could write directly to the DB first, then update your flatfile via mysql client. It really depends what your needs are.


    mysqlimport --fields-enclosed-by=':' --password=yourpass dbname /path/to/flatfile

    Thats a rough start. Check the syntax of mysqlimport for further options in my mysql manual.
    "The only difference between a poor person and a rich person is what they do in their spare time."
    "If youth is wasted on the young, then retirement is wasted on the old"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts