Support » Fixing WordPress » Two Domains, Two WordPress Installs, ONE Database

  • I’ve been reading posts. Lots of material on multiple sites with one database. Still not exactly what I want.

    I want to install two separate WP instances that use a single database. I don’t want each to have separate files–I want one to share the others data. This means I can view siteA and see posts/pages created on siteB and visa versa.

    I tried just tweaking config to point to the remote host but I continue to get Access denied for user. I have other websites that connect to domains across the web…

    Any issues with this syntax?

    define(‘_DB_NAME’, ‘xxxxxx_wrdp1’);
    define(‘_DB_USER’, ‘’);
    define(‘_DB_PASSWORD’, ‘xxxxxxxx’);
    define(‘_DB_HOST’, ‘’);

    $dblink = mysql_connect(_DB_HOST, _DB_USER, _DB_PASSWORD) or die($cyc_db[‘error’].”<b>Connection Failed! Host:</b> “._DB_HOST. ” <b>User:</b> “._DB_USER);
    mysql_select_db(_DB_DATABASE,$dblink) or die($cyc_db[‘error’].”#”.mysql_errno().” “.mysql_error());


Viewing 4 replies - 1 through 4 (of 4 total)
  • Have you checked with your hosts that they will allow cross-domain db connections? Not all hosts allow it.

    Looks like a mysql error–not apache?

    Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘xxxxxx_wrdp1@mi’@’’ (using password: YES) in /home/xxxxxx/public_html/go/testy.php on line 10
    Connection Failed! Host: User:

    OK. Passed the first hurdle. Got the remote connection to work. Had to allow the remote host to connect via Cpanel Remote MySql. So, now I connect and siteB posts/pages all look like SiteA but the links on SiteB (remote site) are all pointing to SiteA domains… So somewhere in that WP code, the URL is being pulled from the options table. If I can find that code, I can check domain name and then set URL accordingly… where is that code? In a class? I’ll have to grep.

    Hi ESMI! I think a found a possible solution… This post describes a solution for what I’m trying to do but the problem is the solution describes tweaking code that no longer exists.

    they say change the options table prefix for the remote site in wp-settings.php but those values no longer exist.

    Functionally, I’ve copied the remote options table to the local database and changed the name of the table. I just need the remote WP code to look at the new options table rather than the default. Where would this code change be? Where can I change which options table is used? Help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Two Domains, Two WordPress Installs, ONE Database’ is closed to new replies.