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
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.

Link to comment
Share on other sites

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...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.