Title: database other than &#8220;wordpress&#8221; database
Last modified: January 8, 2019

---

# database other than “wordpress” database

 *  [onomastico](https://wordpress.org/support/users/onomastico/)
 * (@onomastico)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/)
 * Hi everyone.
    I am projecting to use WordPress for developing an interface to
   the database of my organization, let’s call it “myorg” database. I am not a great
   expert of WP and I need to understand a base thing. Can WP manage a database 
   different from its own database “wordpress” or I must import all my own “myorg”
   database tables in the “wordpress” db ?

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

 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/#post-11060516)
 * There is a database object that is a global variable `$wpdb` that a lot of the
   functions use. But you could define another variable for another database object,
   I think. I haven’t tried it. It is only for connecting, reading, writing. So 
   all the data manipulation after the query would be new functions for your data,
   so it might work.
 * [https://developer.wordpress.org/reference/classes/wpdb/](https://developer.wordpress.org/reference/classes/wpdb/)
 *  Thread Starter [onomastico](https://wordpress.org/support/users/onomastico/)
 * (@onomastico)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/#post-11060585)
 * Thank you Joy for your answer.
    I would like to use WP to speed up the job, so
   please, let me understand : how do usually people move in this situation ? I 
   mean, if I have a starting database I need to work with, is the normal behaviour
   to import that database in “wordpress” database or not ? If I would like to use
   some plugin to build my interface , what is better to do with my external database?
 *  [Joy](https://wordpress.org/support/users/joyously/)
 * (@joyously)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/#post-11060795)
 * I don’t think there is anything “normal”. You just need to decide how you want
   to proceed. What are the benefits and detriments to keeping two databases, and
   same for merging. Think about data entry, user access (permissions and interface),
   data presentation, mixture of data on pages, reports, security, coding impact.
   
   There is no normal, and no one can judge your situation but you.
 *  [Dion](https://wordpress.org/support/users/diondesigns/)
 * (@diondesigns)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/#post-11060887)
 * You can use different databases as long as the WordPress DB user can access both
   databases. I suggest creating a special DB user that has appropriate access to
   only the two databases.
 * You also don’t need to use the WordPress DBAL in your code; in fact, for this
   purpose you probably should not. As long as you add the following lines in your
   WordPress code:
 *     ```
       global $wpdb;
       $dbh = $wpdb->__get('dbh');
       ```
   
 * you can use standard mysqli procedural functions to simultaneously access the
   two databases, using `$dbh` for the database handle. Just remember to **_never_**
   call the `mysqli_close()` function in your code…bad things will happen if you
   do 🙂
 *  Thread Starter [onomastico](https://wordpress.org/support/users/onomastico/)
 * (@onomastico)
 * [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/#post-11063440)
 * Uhmm…Thanks to Joy and DD for your answers.
    Reading your answers and googleing
   I’ve matured a different question changing my starting point. If already exist
   some plugin I can use to realize stuff like data entry, data presentation interfaces
   I prefer to use them, but it’s not easy for my level of wordpress universe knowledge
   to understand what to choose and even how to choose. Yes even “how” becaouse,
   for example, pheraps there is out there a fantastic plugin for csv data presentation
   and I just need to code query and passing data in the right format to the plugin…
 * Can somebody give me some points to refer to, articles or plugin names, something
   different from the wordpress plugin directory.

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

The topic ‘database other than “wordpress” database’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 3 participants
 * Last reply from: [onomastico](https://wordpress.org/support/users/onomastico/)
 * Last activity: [7 years, 2 months ago](https://wordpress.org/support/topic/database-other-than-wordpress-database/#post-11063440)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
