How to import .csv files in the database from phpmyadmin

Before proceeding further, keep in mind  few things to efficiently transfer .csv files in the database from phpmyadmin. Saved your csv file into excel file. Please Do not save it as any other format, check it with a written text such as notepad . Each line must be separated by a comma (,). This is required when we transfer the file within PHPmyAdmin. Remove column titles, blank areas and make certain that there is an entry of some form in each row and column. The information in the table should signify in the same way in the CSV file. If your table has ‘s’ columns you must have ‘s’ columns in the CSV file as well.

Follow the below steps to import .CSV file into database.

1.  Upload .csv file in public_html via FTP.

2.  Access your phpmyadmin >> Select database >> Click on SQL tab.

3. Type following SQL query.

load data local infile ‘Full path for .CSV file’ into table city

fields terminated by ‘,’

enclosed by ‘”‘

lines terminated by ‘\n’

Replace actual full path with “Full path for .CSV file” (/home/username/public_html/filename.csv)

4. Click on Go.

That’all to do.You would also like to know How to scan FTP uploaded files. It will help to keep your server clean from any virus if it get uploaded via FTP.Please Give your opinion below if you experience any issues or to discuss your ideas and experiences.

Leave a Reply

Your email address will not be published. Required fields are marked *