How to import a large files with MySQL?
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;
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;
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;
| # | ID | Query | URL | Count |
|---|---|---|---|---|
| 0 | 13632 | alphons | https://en.ans.wiki/7104/how-to-import-a-large-files-with-mysql | 1 |
| 1 | 13083 | en | https://en.ans.wiki/7104/how-to-import-a-large-files-with-mysql | 6 |