How join two databases data, thats contains auto increment ids, into a new database
Non trivial.  And, if you have FOREIGN KEYS, it will be worse than that.

Plan A:

Do this to every table in one of the databases that has a potentially conflicting id:

UPDATE tbl SET foo_id = foo_id + 1000


(Pick the number based on avoiding the MAX(foo_id) in the other database.)

Then proceed to merge the matching tables.

Plan B:  This has the advantage of not destroying any tables until you have checked the result.

Create a third database and tables.  Write a bunch of SQL statements to carefully copy all the rows from one db, then the other db, to the new db.  Be sure to copy tables in the correct order.  Hopefully, the lets you create new ids for everything.  (I have not thought through the details.)