Title: Php database password access
Last modified: August 20, 2016

---

# Php database password access

 *  [epsir](https://wordpress.org/support/users/epsir/)
 * (@epsir)
 * [14 years ago](https://wordpress.org/support/topic/php-database-password-access/)
 * Hey, I’ve been trying to get a database running for some of my site’s data and
   haven’t found the plugins to be…flexible enough. So I’m trying to more directly
   play with the database through queries in php or such. I know my db username 
   and password and such, my question is how do I securely open my database connection
   without my password hanging out there. I think I remember there being a good 
   way to put it in a variable. Any ideas?
 * specifically using the php call:
    $database=mysql_connect(“localhost”, db_user_here,
   db_pw_here);

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

 *  Thread Starter [epsir](https://wordpress.org/support/users/epsir/)
 * (@epsir)
 * [14 years ago](https://wordpress.org/support/topic/php-database-password-access/#post-2760865)
 * Anyone have an idea on this? I am to understand that hard coding the password
   onto the page calling the database is not a particularly secure idea, unless 
   I’m offbase about that.
 * Trying to sift through plugin code to see how they call the database, but not
   much luck so far.
 *  Moderator [Jan Dembowski](https://wordpress.org/support/users/jdembowski/)
 * (@jdembowski)
 * Forum Moderator and Brute Squad
 * [14 years ago](https://wordpress.org/support/topic/php-database-password-access/#post-2760869)
 * That’s not really a WordPress question and there are [many articles on the Internet](https://www.google.com/#sclient=psy-ab&hl=en&site=&source=hp&q=php+mysql+access&oq=php+mysql+access&aq=f&aqi=g4&aql=&gs_l=hp.3..0l4.964.5108.0.5417.16.10.0.6.6.0.160.956.6j4.10.0...0.0.w9h1_EmbxIQ&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.,cf.osb&fp=caee76477ebf5dd&biw=1285&bih=826)
   for answering that PHP/mysql question.
 *  Thread Starter [epsir](https://wordpress.org/support/users/epsir/)
 * (@epsir)
 * [14 years ago](https://wordpress.org/support/topic/php-database-password-access/#post-2760879)
 * Apparently it is a wordpress question. I may be able to get around needing to
   type information in by using the wpdb class. Which curiously is said to be instantiated
   as a global variable but says you still need to globalize it. Doesn’t say where
   it’s instantiated, will poke around.
 *  Thread Starter [epsir](https://wordpress.org/support/users/epsir/)
 * (@epsir)
 * [14 years ago](https://wordpress.org/support/topic/php-database-password-access/#post-2760888)
 * Apparently I just put
 * global $wpdb;
 * right before my code. Doesn’t…make entire sense to me but whatever.
 * Should be enough for me to go off of now.

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

The topic ‘Php database password access’ is closed to new replies.

## Tags

 * [database](https://wordpress.org/support/topic-tag/database/)
 * [password](https://wordpress.org/support/topic-tag/password/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 4 replies
 * 2 participants
 * Last reply from: [epsir](https://wordpress.org/support/users/epsir/)
 * Last activity: [14 years ago](https://wordpress.org/support/topic/php-database-password-access/#post-2760888)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
