A
A
antohabio2022-04-20 15:08:25
MySQL
antohabio, 2022-04-20 15:08:25

What happens when you run the MySQL source command again?

Good afternoon.
Importing a large database using the command MySQL source. The execution of the command is periodically interrupted, I start it again. The process goes on.
What happens on restart? Is the presence of already imported records checked, are they skipped and missing ones imported?
The database size increases during these manipulations.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Akina, 2022-04-20
@Akina

What happens on restart? Is the presence of already imported records checked, are they skipped and missing ones imported?

No checks. Start from the very beginning.
When restarting, you should take into account that some of the requests from the script have already been executed and, most likely, fixed. In this case, restarting can lead to: duplication of records (if duplication is allowed by the structure), duplication error (if it doesn’t - and in general, don’t run it again, you won’t get to the end), to receive incorrect data (for example, in the presence of aggregating triggers)...
In general, as usual. If an error occurs, you should not try to start it again, like maybe it will crawl through (almost certainly it will not crawl through), but figure out why the error occurred and eliminate the cause.

M
Melkij, 2022-04-20
@melkij

source reads the specified file from beginning to end, passes it to the server as if it were SQL commands. No additional logic is assumed.
https://dev.mysql.com/doc/refman/8.0/en/mysql-batc...
Equivalent to "mysql db_name < text_file"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question