by Randy Thornton.
The answer is yes, you can do this in the
database. For tables with auto incrementing columns, you can use the auto_increment_offset value to specifically set the starting point number. It's a
MySQL global and session variable, defaulting to 1.
This is commonly used in situations where you are replicating databases and need to avoid a collision of auto incrementing columns. For instance
server one may have a table with have an offset of 1 and increment of 2, and a second server two may have it set to an offset of 2 and an increment of 2 - and so the servers will have the following patterns: 1,3,5,7,9 for server one and 2,4,6,8,10 for server two. A practical use of this in Moodle would be with something like managing multiple logs, where you want to replicate the logs from several Moodle servers to a single table on another server, retaining the original ids.
See:
https://dev.mysql.com/doc/refman/8.0/en/replication-options-source.html and
https://www.percona.com/blog/2011/01/12/conflict-avoidance-with-auto_increment_incremen-and-auto_increment_offset/
Of course, the offset marks the starting number only. So you want to make sure that the second one starts with a number higher than the first one is every going to reach. And the maximum offset number is 65535.