Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Dendi Handian
Dendi Handian

Posted on • Edited on

     

Import and Export Large SQL File in Laragon

Importing or Exportinglarge SQL file through PHPMyAdmin or Adminer may not be a good idea, since there is a chance of getting timeout or it's just taking to long to wait. A more powerful way to import large SQL file is through MySQL CLI. Laragon has its own environment terminal where all MySQL CLI command are executable from any directory. Let's try it out.

Checking the MySQL CLI command

Open the laragon terminal (Cmder), the working directory should be started atC:\laragon\www by default.

laragon dashboard pointing to terminal

laragon terminal startup

Try to check the mysql version to confirm the command is available in the current directory or anywhere:

mysql--version
Enter fullscreen modeExit fullscreen mode

mysql version check

Creating a demo database (MySQL)

The completed credential example for this demo are:

  • host:localhost
  • user:myuser
  • password:mypassword
  • database:my_large_db

For the demo, you may want to create a new database namedmy_large_db using web UI (phpMyAdmin or Adminer) or happily using this mysql cli command:

mysql-hlocalhost -umyuser -pmypassword -e"CREATE DATABASE my_large_db"
Enter fullscreen modeExit fullscreen mode

Importing Large SQL file (MySQL)

Let's say your large SQL file is located in theDownloads folder and it's namedmy_large_db.sql. Let's go the directory by terminal:

cdC:\Users\yourusername\Downloads
Enter fullscreen modeExit fullscreen mode

Then we can import the file from the directory using this command:

mysql-hlocalhost -umyuser -pmypasswordmy_large_db<my_large_db.sql
Enter fullscreen modeExit fullscreen mode

This import will take time but it's should faster than importing from a web UI.

Exporting Large DB (MySQL)

You can go to any directory you want using laragon terminal (Cmder) and that directory is where you will put the database dump file. Let's say we're gonna exporting the same datbase but into another sql file namedmy_large_db_backup.sql:

mysql-hlocalhost -umyuser -pmypasswordmy_large_db>my_large_db_backup.sql
Enter fullscreen modeExit fullscreen mode

or alternatively usingmysqldump command:

mysqldump-hlocalhost -umyuser -pmypasswordmy_large_db>my_large_db_backup.sql
Enter fullscreen modeExit fullscreen mode

Tell me if this article is so helpful and helped you solve your problem in the comment below. Have fun exploring laragon.

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
itkhansunny profile image
Khan Sunny
Full Stack Web Developer || Freelancer || Content Creator || Blog Writer

Thank you dear for this artical

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Data Engineer - Building Data Lake & Modern Data Architecture
  • Location
    Jakarta
  • Education
    B.S. Computer Science
  • Work
    Data Engineer at Media Production Company
  • Joined

More fromDendi Handian

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp