Opened 13 years ago
Closed 13 years ago
#14654 closed enhancement (fixed)
When WP_DEBUG, mysql socket error should be displayed
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.1 | Priority: | low |
Severity: | minor | Version: | 3.0.1 |
Component: | Upgrade/Install | Keywords: | has-patch |
Focuses: | Cc: |
Description
When WP_DEBUG
, mysql socket error should be displayed
Currently the standard "Error establishing a database connection" is displayed:
This either means that the username and password information in your wp-config.php file is incorrect or we can't contact the database server at localhost. This could mean your host's database server is down. Are you sure you have the correct username and password? Are you sure that you have typed the correct hostname? Are you sure that the database server is running? If you're unsure what these terms mean you should probably contact your host. If you still need help you can always visit the WordPress Support Forums.
ENV: wp trunk r15511
REPRO
To reproduce change mysql.default_socket
to some nonsense path in php.ini
ADDITIONAL DETAILS
Based on my WordCamp Genius Bar experiences this is a surprisingly common problem people have when setting up their local development environment. My Sept 2008 related post http://foolswisdom.com/mac-wordpress-error-establishing-a-database-connection/ still gets traffic and thank yous.
WORKAROUND
Don't suppress the error condition on mysql_connect()
in wp-includes/wp-db.php
- $this->dbh = @mysql_connect( $dbhost, $dbuser, $dbpassword, true ); + $this->dbh = mysql_connect( $dbhost, $dbuser, $dbpassword, true );
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Do Errors on first mysql_connect when WP_DEBUG is true