Title: Accessing Remote MySQL databases
Last modified: August 31, 2016

---

# Accessing Remote MySQL databases

 *  [srqwebguy1](https://wordpress.org/support/users/srqwebguy1/)
 * (@srqwebguy1)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/accessing-remote-mysql-databases/)
 * We have several existing databases that we would like to search and display results
   from within WordPress. We have installed plugins to enable PHP coding, but any
   attempt to access these databases fails. Every search for help with this seems
   to only produce info on problems accessing the WP database. Surely we cannot 
   be the only ones with this issue. Any suggestions on how we can get that accomplished?
 * We have multiple databases that are currently being used by a few non-WP sites,
   so simply copying their data into a WP table is not an option for us.
 * Thanks in advance for any suggestions.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [AndreasN.OTGS](https://wordpress.org/support/users/andreasnotgs/)
 * (@andreasnotgs)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/accessing-remote-mysql-databases/#post-6987266)
 * Since I’m not familiar with your setup and installations – allow my to ask/mention
   this:
 * 1) Remote-ness of your external MySQL databases
    Are the remote MySQL DBs on 
   the same *DB server* as your WordPress installation?
 * 2) If not – make sure to grant these remote MySQL DBs “remote access” privileges.
   
   This can be done often via the hosting panel. Example: [http://www.liquidweb.com/kb/enable-remote-mysql-connections-in-cpanel/](http://www.liquidweb.com/kb/enable-remote-mysql-connections-in-cpanel/)
 * 3) WP operates with the $wpdb object using the data provided in the `wp-config.
   php` of the WP installation
    In order to get data from another WP database but
   using all WP functionality you need to register another $wpdb object. Like this-
   > [http://wordpress.stackexchange.com/questions/1604/using-wpdb-to-connect-to-a-separate-database](http://wordpress.stackexchange.com/questions/1604/using-wpdb-to-connect-to-a-separate-database)
 * Hope this helps a little bit 🙂
 *  [Mark Ratledge](https://wordpress.org/support/users/songdogtech/)
 * (@songdogtech)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/accessing-remote-mysql-databases/#post-6987267)
 * Take a look at [https://codex.wordpress.org/Class_Reference/wpdb](https://codex.wordpress.org/Class_Reference/wpdb)
   for examples and methods.
 * And see [https://codex.wordpress.org/WP_DEBUG](https://codex.wordpress.org/WP_DEBUG)
 *     ```
       define( 'WP_DEBUG', true );
       define( 'WP_DEBUG_LOG', true );
       ```
   
 * in wp-config.php and the debug.log file will be in wp-content.
 * Add this
 * `define( 'WP_DEBUG_DISPLAY', true);`
 * to wp-config.php to log and dump them to the browser.
 *  Thread Starter [srqwebguy1](https://wordpress.org/support/users/srqwebguy1/)
 * (@srqwebguy1)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/accessing-remote-mysql-databases/#post-6987315)
 * Thank you, both. The databases are on the same server that we are building this
   WP install. In my continuing research I came across a reference to the $wpdb 
   object and thought that might be something we needed to look into. We will follow
   up and see if we can figure this out! Appreciate the responses –

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Accessing Remote MySQL databases’ is closed to new replies.

## Tags

 * [3rd party](https://wordpress.org/support/topic-tag/3rd-party/)
 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [Remote](https://wordpress.org/support/topic-tag/remote/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [srqwebguy1](https://wordpress.org/support/users/srqwebguy1/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/accessing-remote-mysql-databases/#post-6987315)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
