Transferring a flat file database to a MySQL database

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2011-01-09T23:24:48Z Indexed on 2011/01/09 23:53 UTC
Read the original article Hit count: 163

Filed under:

I have a flat file database (yeah gross I know - the worst part is that it's 1.4GB), and I'm in the process of moving it to a MySQL database. The problem is that I'm not sure how to go about doing this - and I've checked through every related question on here but none relate to what I want to do, nor how my database is currently setup.

My current flat file database is setup to where a normal MySQL row is its own file, and a MySQL table would be the directory. So for example if you have a user named Jon, there would be a file for the user in a directory named /members/. Within that file would be various information for the user including the users id, rank etc - all separated by tabs, all on separate lines (userid\t4).

So here's an example user file:

userid     4
notes      staff notes: bla bla    staff2 notes: bla bla bla
username   Example

So how can I convert the above into their own rows and fields in MySQL? And if possible, could I do thousands of these files at once?


© Stack Overflow or respective owner

Related posts about mysql

Related posts about database