CSV stands for Comma-separated values. It contains data in tabular form and csv files are saved with .csv extensions and are in plain text, which means it can be edited in any text editor.
As they are in tabular form, similar to tables in MySQL or cells in a spreadsheet software. You may find a need to move your csv file to MySQL database.
Here’s how to do it.
In this tutorial, we’ll move the csv file which is IP.csv to our MySQL database in movies table.
- Step 1:- create a table, name the fields and specify the constraints which are required.
- Step 2:- Make a csv file if you haven't already with fields similar in MySQL
- Step 3:- Open MySQL Workbench which comes with MySQL client
- Step 4:- Open your table which in which you'd like to move your csv file
- Step 5:- click on import button to import csv or json datafiles
Step 1:- create a table, name the fields and specify the constraints which are required.
In this case, we have table movies.

Step 2:- Make a csv file if you haven’t already with fields similar in MySQL
In this case, we’ll use IP.csv. Here’s what a csv file looks like.

Step 3:- Open MySQL Workbench which comes with MySQL client
open MySQL workbench

Click on local instance, it may ask for your password. Then a New window will appear.

Step 4:- Open your table which in which you’d like to move your csv file
Enter the commands and click on run button . As you haven’t entered any data, so the table content will show null.

Empty table:-

Step 5:- click on import button to import csv or json datafiles

Proceed to complete the wizard as shown in the picture.

As we’re using our existing table structure, click on use existing table option. Also don’t forget to choose the correct table name, in this case it is movies.
It is mentioned sy.movies which means movies table inside the database name sy.

Make sure to import all the fields by checking the check marks.

All Done! Now, your csv file is importing in your MySQL database. It may take few seconds depending on the size of csv.

Now run the commands again. This timetable will be displayed in place of null cells.

Tried this but still facing problems let me know in comments 🙂