I have two databases
Database 1: (Allows users to add posts similar to a blog):
posts table
Users Table
Categories Table
Database 2:
Users table
few other tables irrelevant for this question
What I am after is letting users from Database 2 add posts to database 1 using database 1 categories, but I am unsure how to control this as both databases have users table and the uids are used in many other tables in each database + maintaining 2 mysql links in php is not very easy if the connection identifier was not used in queries when building the scripts especially because both scripts were written like 6 years ago so no fancy stuffs just simple functional scripts.
What’s the easiest way to get around this problem ?
There are a lot of ways to do this, as discussed in this post, but I’ve highlighted the answer that, I feel, is the best solution for the long term.
Yes, this will require you to tear down a lot of your key constraints and other table-based relationships, but you can repeat this process indefinitely and suffer no consequence (outside of a little headache).
p.s. the selected answer for that same post is a common workaround for generating new unique ids, but you’ll have to lift any columns that have a AUTO_INCREMENT property for it to work.