Cara Import Database File .sql dengan Kapasitas Besar

AH
Ahmad Lukman Hakim

Dedicated Author of LUKMANLAB

# mysql

Tujuan

  • Import file .sql ( restore database ) dengan kapsitas 4 GB.

Langkah-langkah

  • Siapkan file .sql, upload ke server anda.

  • Pastikan anda punya akses root login ke MySQL

  • Seperti contoh disini misalkan, ada file .sql didalam Home direktori user saya.

ls -lah ~/

db-backup_20241113.sql

Tips: Gunakan utility seperti screen atau yang lain untuk menangani koneksi remote SSH terputus sewaktu-waktu.

  • Login ke MySQL server
mysql -u root -h 127.0.0.1 -p
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 8
Server version: 8.0.39 MySQL Community Server - GPL

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>
  • Lakukan proses import database
mysql> use lukmanlab_db;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> source db-backup_20241113.sql;

Contoh output:

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)

Query OK, 0 rows affected (0.00 sec)