Title: reconnect with wp-config.php
Last modified: August 18, 2016

---

# reconnect with wp-config.php

 *  Resolved [sophistikat](https://wordpress.org/support/users/sophistikat/)
 * (@sophistikat)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/reconnect-with-wp-configphp/)
 * how do you access the variables from wp-config.php?
 * i don’t want to write;
 * > $db = mysql_connect($DB_HOST, $DB_USER, $DB_PASSWORD) or die(‘Could not connect:‘.
   > mysql_error());
   >  mysql_select_db($DB_NAME) or die(‘Could not select database’);
 * I need to connect multiple times and don’t want to write the information multiple
   times because once it goes live it will change.

Viewing 1 replies (of 1 total)

 *  Thread Starter [sophistikat](https://wordpress.org/support/users/sophistikat/)
 * (@sophistikat)
 * [18 years, 10 months ago](https://wordpress.org/support/topic/reconnect-with-wp-configphp/#post-595514)
 * just for sh** and giggles, i removed the dollar sign and it works:
 *     ```
       $db = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
       mysql_select_db(DB_NAME);
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘reconnect with wp-config.php’ is closed to new replies.

## Tags

 * [MySQL](https://wordpress.org/support/topic-tag/mysql/)
 * [wp-config.php](https://wordpress.org/support/topic-tag/wp-config-php/)

 * 1 reply
 * 1 participant
 * Last reply from: [sophistikat](https://wordpress.org/support/users/sophistikat/)
 * Last activity: [18 years, 10 months ago](https://wordpress.org/support/topic/reconnect-with-wp-configphp/#post-595514)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
