Importing or Exporting large 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 at
C:\laragon\www by default.
Try to check the mysql version to confirm the command is available in the current directory or anywhere:
Creating a demo database (MySQL)
The completed credential example for this demo are:
For the demo, you may want to create a new database named
my_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"
Importing Large SQL file (MySQL)
Let's say your large SQL file is located in the
Downloads folder and it's named
my_large_db.sql. Let's go the directory by terminal:
Then we can import the file from the directory using this command:
mysql -hlocalhost -umyuser -pmypassword my_large_db < my_large_db.sql
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 named
mysql -hlocalhost -umyuser -pmypassword my_large_db > my_large_db_backup.sql
or alternatively using
mysqldump -hlocalhost -umyuser -pmypassword my_large_db > my_large_db_backup.sql
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)
Thank you dear for this artical