Question #5570   Submitted by Answiki on 12/20/2021 at 07:50:12 PM UTC

How to import a large database with MySQL?

Answer   Submitted by Answiki on 12/20/2021 at 07:55:19 PM UTC

The following steps allow the import of a large database with MySQL.


1. The first step is to connect to the MySQL interface (-u for username, -p for password):

mysql -u [USERNAME] -p

2. If necessary, create the database that will receive the imported file

CREATE DATABASE [DATABASE] CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. You must then specify the database into which the data will be imported:

use [DATABASE]

4. To avoid any problem during the import, it may be necessary to disable foreign keys checking:

SET foreign_key_checks = 0;

5. You can now import data from file:

source [FILENAME]

6. Once the import is complete, you can check the foreign keys.

SET foreign_key_checks = 1;

4 events in history
Question by Imabot 11/25/2022 at 11:59:07 AM
How to import a large files with MySQL?
Answer by Answiki on 12/20/2021 at 07:55:19 PM

The following steps allow the import of a large database with MySQL.


1. The first step is to connect to the MySQL interface (-u for username, -p for password):

mysql -u [USERNAME] -p

2. If necessary, create the database that will receive the imported file

CREATE DATABASE [DATABASE] CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. You must then specify the database into which the data will be imported:

use [DATABASE]

4. To avoid any problem during the import, it may be necessary to disable foreign keys checking:

SET foreign_key_checks = 0;

5. You can now import data from file:

source [FILENAME]

6. Once the import is complete, you can check the foreign keys.

SET foreign_key_checks = 1;

Answer by Answiki on 12/20/2021 at 07:54:42 PM

The following steps import a large database with MySQL.


1. The first step is to connect to the MySQL interface (-u for username, -p for password):

mysql -u [USERNAME] -p

2. If necessary, create the database that will receive the imported file

CREATE DATABASE [DATABASE] CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;

3. You must then specify the database into which the data will be imported:

use [DATABASE]

4. To avoid any problem during the import, it may be necessary to disable foreign keys checking:

SET foreign_key_checks = 0;

5. You can now import data from file:

source [FILENAME]

6. Once the import is complete, you can check the foreign keys.

SET foreign_key_checks = 1;

Question by Answiki 12/20/2021 at 07:50:12 PM
How to import a large database with MySQL?
# ID Query URL Count

Icons proudly provided by Friconix.