2 Applications - Same Database


#1

Hello,

I am wondering if is possible 2 different applications hosted at Cloudways access the same DB in just one of the applications…

Someone has this working ?

Thanks!


#2

Yes, as long as the two applications have different table prefixes. Although it might be easier to create a blank application just for an additional db so it can be restored without affecting the other app.


#3

Further, if you want the two wordpress sites (A and B) to have the same users (email, password, etc). you can put this in the WP_CONFIG. E.g. put this in the WP_CONFIG of B to make it use the users of A.
define( ‘CUSTOM_USER_TABLE’, ‘A_users’ );
define( ‘CUSTOM_USER_META_TABLE’, ‘A_usermeta’ );


#4

Yes working fine for me.


#5

I second @wintercorn’s answer. You can easily use one DB for two WordPress applications by defining the required parameters inside the wp-config.php file. It is better to launch a separate application solely for the DB and then connect both the WordPress applications to that DB.

Regards,
Ibad Rehman