Jump to content
xisto Community
Sign in to follow this  
Carson

Importing Cvs Files In Phpmyadmin

Recommended Posts

More Database problems...I need to know how to import CSV files into existing tables, in PhpMyAdmin. For example, I have a members table, which contains 220 members. Now, I have a CSV file which contains another 50 members, obtained after I last backed up my database(With 220 members). The data for the extra members have been exported in CSV form, so I need to import this data into the members table, to get the rest of the members. I also need to do this for a few other tables. I hope I can get some help with this. Thanks in advance.

Share this post


Link to post
Share on other sites

It looks like no one knows how to do this. I figured it out on my own, and I will explain it here and hopefully this will help some people. In my case, I had a previously backed up database, so I had all the database tables uploaded. First of all, open PhpMyAdmin from your CPanel. In order to import data into your tables, by using a CSV file, you first must select the database, and then click on the table which you want to import the data into. Once you have selected the table, you will a row of tabs at the top. Click on the "Import" tab. Now click on the "Browse" button, and select the CSV file you want to import. In the "Format of imported file" box, the CSV radio button should already be selected. Depending on the layout of your CSV file, you may need to select the "CSV using LOAD DATA" radio button. There are other options inside the "Options for CSV import using LOAD DATA" which are Replace table data with file, Ignore duplicate rows. You should know if you need to select those or not.Then just click on the "Go" button, and the data in your CSV file should be imported into the table.

Share this post


Link to post
Share on other sites

I find it a lot more easier to handle mysql tables through command line interface. For instance if you want to upload a csv file to a table just do:

 

>load data local infile 'yourfile.csv' into table yourtable fields terminated by ';' lines terminated by '\n' (field1,field2,...,fieldN);

 

Try it :)

 

Once you get used to it it will be a lot easier for you too.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | 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.