Jump to content

[SOLVED] Help import text file into mySQL


mazman13

Recommended Posts

Ok. So I have alot of initial data that I need to put in a database.

I really don't want to add everything line by line...

 

I know there is a way to put everything into a text file and import it.

What's the best way to do this? Can I just type what I need in notepad?

Put a ',' for every break and a space for every line end?

 

What query do I need for mySQL and where do I load the file 2?

Thanks

Link to comment
https://forums.phpfreaks.com/topic/126746-solved-help-import-text-file-into-mysql/
Share on other sites

Depends on the current data format.

 

You can use a spreadsheet and save it as a CSV file.  CSV files can be imported into a database table.  I use HeidiSQL. CSV files use commas and quotations to designate rows and cols.

 

If you are starting from scratch I would put it into a spreadsheet and import each table.

I have the same problem with my host.  Some hosts force you to use phpmyadmin...

 

Hack fix:  Build your db locally (localhost).  You can export your db from phpmyadmin and import it locally with heidisql.  Use heidisql to import the csv to your local copy of the db.  Export the db tables as sql format.  Import the .sql file into phpmyadmin...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.