Close Menu
  • Home
  • SEO
  • Programming
  • Google Products
  • Solutions
  • Tech Guidance
  • More
    • About Us
    • Contact Us
    • Privacy Policy
    • Advertise
CybercityHelp
  • Home
  • SEO
  • Programming
  • Google Products
  • Solutions
  • Tech Guidance
  • More
    • About Us
    • Contact Us
    • Privacy Policy
    • Advertise
CybercityHelp
Home » MySQL Tutorial: How to Import CSV or SQL Files into MySQL?
Programming

MySQL Tutorial: How to Import CSV or SQL Files into MySQL?

Akash PanditBy Akash PanditNovember 27, 2025Updated:January 17, 202615 Comments4 Mins Read
MySQL Tutorial: How to Import CSV or SQL Files into MySQL?
MySQL Tutorial: How to Import CSV or SQL Files into MySQL?

Hello everyone, welcome back to CybercityHelp. So in our last article, we explained the installation process of MySQL. We hope you were able to install MySQL successfully on your computer. If you are ready with the installation, you can proceed with this article.

However, if you are a new user who hasn’t installed MySQL yet, we request you to first install it and then continue learning without interruption. If you don’t know how to install, you may read our installation guide article here: MySQL Installation Guide.

So in today’s article, we are going to discuss how to import CSV or sample SQL files into MySQL. We will show simple commands, methods, and provide examples to make it easy to understand. So let’s get started.

How to Import an SQL File into MySQL?

So, how can you import an SQL file? Let’s understand step by step. I have one SQL file hosted on GitHub, I will provide the link. First, open that link in a new tab. You will be redirected to our GitHub repository, where you will get a “Download Raw File” option. Click that and download the raw file. Once the file is downloaded, save it in your desired directory. Here is the download link of that sample SQL file: SQL File Sample

After saving the SQL file in your desired directory, open MySQL Workbench (or your MySQL client). Go to Server → Data Import.

Data Import Example:

CybercityHelp

Once you click on Data Import, choose the option Import from Self-Contained File. Then select the location of the SQL file you downloaded and then click Open (or drag & drop the file). After that, click Start Import. If you don’t see the button immediately, check the Import Progress section.

Self-Contained File Example:

CybercityHelp

Once the import completes, click Refresh on the left-hand side. You should now see the Classic Models database with tables such as Customers, Employees, Offices, Orders, Payments, Product Lines, and Products. This is how you import a MySQL raw file.

Imported Data Example:

CybercityHelp

How to Import Small CSV Files into MySQL?

Now let’s discuss about importing CSV files into MySQL. First, you need a database to import the CSV into. Use an existing database or create a new one. To create a new database, open the query window and run:

CREATE DATABASE demo;

Query Example:

CybercityHelp

After running this command and refreshing, you will see a new database named “demo“. Initially it will be empty.

Now right-click on Import from the top menu bar and select Table Data Import Wizard. Click Browse and choose your CSV file.

Data Import Wizard Example:

CybercityHelp

For example, open a Pizza Sales CSV file. You might see files like Orders or Pizza Types. Choose Pizza, click Open, then Next. Select Create a New Table (name it Pizza) and continue by clicking Next.

Pizza Database File Example:

CybercityHelp

You may need to map column types (text, integer, float/double, etc.). Click Next and wait then the wizard will import the records. After finishing, refresh the database and you will see the Pizza table with imported rows.

Note: In real industry workflows, data more commonly flows from SQL → CSV/XLSX rather than the other way around. Still, this method is useful for practice and small datasets.

How to Import Large CSV Files into MySQL?

The wizard works fine for small datasets (100–200 rows). For large datasets (thousands of rows), the wizard may create the table but import zero records. For large CSV files, create the table manually first with the correct data types and primary keys.

For example, create an orders table manually:

CREATE TABLE orders (
    order_id INT NOT NULL,
    order_date DATE NOT NULL,
    order_time TIME NOT NULL,
    PRIMARY KEY (order_id)
);

Query window Example:

CybercityHelp

Run the query and refresh the database (ensure the correct database, e.g., “demo“, is selected). Now the Orders table will exist. Right-click → Table Data Import Wizard, but this time choose the existing table (Orders). Map CSV columns (Order ID, Order Date, Order Time) to the table columns and proceed.

Data Import Wizard Example:

CybercityHelp

It may take a while depending on the row count. After completion, the records will be imported successfully.

So this is how you can import large CSV files into MySQL. Remember, for production-level ETL, different automated tools and pipelines are used, but this manual method is useful for practice and learning.

We hope this article made it clear how to import SQL and CSV files into MySQL. In upcoming articles, we will discuss more techniques and other methods related to data import and management. If you still have any doubts about these methods, feel free to ask in the comment section. So yeah, that’s all for today’s article, thank you so much for reading till here!!

“So keep learning, keep growing!”

Post Views: 88,652
How to add existing SQL file to MySQL Database How to Import an SQL File into MySQL? How to Import Large CSV Files into MySQL? How to Import Small CSV Files into MySQL? How to upload SQL file to MySQL
Previous ArticleMySQL Installation Guide: How to Install MySQL on Windows, Linux or Ubantu?
Next Article MySQL Concepts: How to Retrieve Data Using SELECT and WHERE Clauses in MySQL?
Akash Pandit
  • Website

Related Posts

NumPy Library: What Exactly is this & How It’s used in Python?

December 13, 2025

Python print() Function: Definition, Syntax, Methods, and Use Cases

December 11, 2025

PyCharm Installation: What is PyCharm & How to Install PyCharm?

December 9, 2025

15 Comments

  1. K velu on November 23, 2023 12:09 pm

    It’s asome

    Reply
    • Arun on February 27, 2024 3:48 am

      This article is very interesting 😘😘😘😘

      Reply
    • Karthick on March 13, 2024 3:46 pm

      Good

      Reply
  2. Karthick on March 13, 2024 3:44 pm

    Good

    Reply
  3. Gurpreet on March 17, 2024 1:25 am

    Nice

    Reply
  4. Gurpreet on March 17, 2024 1:25 am

    That’s nice to me

    Reply
  5. Sabbir on March 28, 2024 7:07 am

    Good explanation

    Reply
  6. JENI on March 29, 2024 7:38 am

    Good

    Reply
  7. Sumit on May 3, 2024 7:50 am

    Nice

    Reply
  8. Sumit on May 3, 2024 7:52 am

    That’s nice to me

    Reply
  9. Chintu on June 7, 2024 6:18 pm

    Nice

    Reply
  10. gta 6 on July 22, 2024 9:25 am

    Nice

    Reply
  11. Samsuddin on September 17, 2024 5:06 am

    Nice

    Reply
  12. Hhjshah on September 28, 2024 8:49 am

    Super

    Reply
  13. VN GAMER on September 29, 2024 2:01 am

    Nice 👍👍👍

    Reply
Leave A Reply Cancel Reply

Categories
  • Google Products (11)
  • Programming (11)
  • SEO (8)
  • Solutions (1)
  • Tech Guidance (2)
Pages
  • About Us
  • Advertise
  • Contact Us
  • Privacy Policy
Recent Posts
  • 100 Continue: What it is, Why it Appears & Should You Worry About It?
  • 301 Redirection: When to Use It and When to Avoid It & Why It Is Risky for SEO?
  • How to Connect VPS server to Command Line Interface?
  • Shared Drive: What it is, Pros and Cons & How to Get a Shared Drive?
  • Google Ads: What it is, Features, Keyword Planner & How to Get Started?
Copyright © 2026, All Rights Reserved By CybercityHelp.in

Type above and press Enter to search. Press Esc to cancel.

Ad Blocker Detected!
Ad Blocker Detected!
Our website is made possible by displaying online advertisements to our visitors. Please support us by disabling your Ad Blocker.
Refresh