sagnik Posted August 13, 2024 Posted August 13, 2024 Hi, is there any way to create a foreign key linked to another database? I can't see all the databases in PMA. Quote
wolstech Posted August 13, 2024 Posted August 13, 2024 This does not appear to be supported on Plesk (though it technically is possible in mariadb). It's generally considered to be poor practice anyway, insomuch that mysql/mariadb is one of the only major engines that even supports it. Postgres and SQL Server expressly refuse to support this (in Postgres you can do it between schemas but not databases, and sql server simply has no support at all, you need to use triggers). Allowing this actually causes all sorts of issues with database integrity too, for example, what happens if one of the two databases goes missing or is rolled back to a backup? 1 Quote
sagnik Posted August 14, 2024 Author Posted August 14, 2024 @wolstech Okay, I got your point. But I have a centralized login system for all the services/platforms which uses a database called "members" and the tables (specifically, "accounts") in it and a specific column of that table namely "uid" as a foreign key relation, i.e. if a row of that table is deleted this would delete all the information located throughout all other databases related to the "uid". Please let me know if there are any other ways to achieve this. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.