WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Error Establishing DB connection (23 posts)

  1. dougrdotnet
    Member
    Posted 6 years ago #

    Setting up WordPress locally on my Mac testing server.
    Mac OS X 10.5
    Apache 2.2.6
    MySQL 4.1.2
    PHP 5.2.4
    WordPress 2.3.3
    All servers confirmed runnng normally.
    wp-config.php:

    <?php
    // ** MySQL settings ** //
    define('DB_NAME', 'dougrdotnet');    // The name of the database
    define('DB_USER', 'root');     // Your MySQL username
    define('DB_PASSWORD', ''); // ...and password
    define('DB_HOST', 'localhost');    // 99% chance you won't need to change this value
    
    // You can have multiple installations in one database if you give each a unique prefix
    $table_prefix  = 'wp_';   // Only numbers, letters, and underscores please!
    
    // Change this to localize WordPress.  A corresponding MO file for the
    // chosen language must be installed to wp-content/languages.
    // For example, install de.mo to wp-content/languages and set WPLANG to 'de'
    // to enable German language support.
    define ('WPLANG', '');
    
    /* That's all, stop editing! Happy blogging. */
    
    define('ABSPATH', dirname(__FILE__).'/');
    require_once(ABSPATH.'wp-settings.php');
    ?>


    Confirmed that database settings as shown in config are correct - am able to connect to db using these settings through ColdFusion server as well as CocoaMySQL using root with blank pass. Have tried using pass just in case config not accepting empty string.
    What do you think?

  2. dougrdotnet
    Member
    Posted 6 years ago #

    Just had a look at my PHP configurtion and noticed that the MySQL client version is diff from my actual server. Using PHP install from Leopard - could this be the issue:

    mysql
    MySQL Support	enabled
    Active Persistent Links 	0
    Active Links 	0
    Client API version 	5.0.45
    MYSQL_MODULE_TYPE 	external
    MYSQL_SOCKET 	/var/mysql/mysql.sock
    MYSQL_INCLUDE 	-I/usr/include/mysql
    MYSQL_LIBS 	-L/usr/lib/mysql -lmysqlclient
    
    Directive	Local Value	Master Value
    mysql.allow_persistent	On	On
    mysql.connect_timeout	60	60
    mysql.default_host	localhost	localhost
    mysql.default_password	no value	no value
    mysql.default_port	3306	3306
    mysql.default_socket	no value	no value
    mysql.default_user	root	root
    mysql.max_links	Unlimited	Unlimited
    mysql.max_persistent	Unlimited	Unlimited
    mysql.trace_mode	Off	Off
  3. moshu
    Member
    Posted 6 years ago #

    This is NOT a "how-to-set-up-a-server" forum. Sorry.

    Make your server running with all the required components and then come back to ask WP related questions.

  4. dougrdotnet
    Member
    Posted 6 years ago #

    Hi Moshu, not asking how to set up my server, I know this. Please answer my first post, the remainder was soley for additional information. Are you up to that?

  5. moshu
    Member
    Posted 6 years ago #

    There is nothing much to answer: if it displays an error message - it is a human mistake in the data entered into the config file. Period.

    There are more error messages... so the info in it should tell you exactly what the problem is.

  6. dougrdotnet
    Member
    Posted 6 years ago #

    Moshu, according to the WordPress "Before you Install" documentation I meet or exceed all specifications. So my server is running with all the required components. So, given the copious amount of information which you quickly shunned... any ideas?

  7. dougrdotnet
    Member
    Posted 6 years ago #

    Where may I find more error messages, have I missed a log file somewhere?

  8. moshu
    Member
    Posted 6 years ago #

    No, you did NOT quote the error message that you get from WP.
    You just put its first line into the topic title here.
    If you got that one with 3 questions... can you answer a 120% YES to all of them?

  9. dougrdotnet
    Member
    Posted 6 years ago #

    Do you see an error in my config file provided in first post? The db name, user, pass, & host are confirmed correct.

  10. dougrdotnet
    Member
    Posted 6 years ago #

    That is the only error for which I received.

  11. dougrdotnet
    Member
    Posted 6 years ago #

    Moshu, dude, let's be friends!

  12. dougrdotnet
    Member
    Posted 6 years ago #

    So you are looking for this:

    Error establishing a database connection
    
    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.

    I have checked and confirmed these settings through Rails, ColdFusion, CocoaMySQL, and MySQL terminal.

  13. moshu
    Member
    Posted 6 years ago #

    I assumed that you got only one error, but I know that WP can show other error messages, too - depending on what is screwed up in the config file or DB. That's why I was asking for the exact error message!

    OK, now we know which one you got. And believe me, despite what the users always say (i.e. "confirmed correct") - it is never correct. There is always a typo, a space, wrong db name, user not added to the db, etc.
    The error message NEVER lies: one of the 3 info pieces is false.

  14. dougrdotnet
    Member
    Posted 6 years ago #

    I have not checked for a space, let me do that real quick

  15. dougrdotnet
    Member
    Posted 6 years ago #

    Unfortunately, no additional spaces. Copied over with the original sample and selected within single quotes replacing with db values. Same issue. Hmmm... Well thanks for looking at it!

  16. moshu
    Member
    Posted 6 years ago #

    Well, I do't know. I have no idea how servers work, and don't even want to know - although I have a local install using XAMPP: it's convenient because your don't have to struggle with all the components (apache, php, mysql etc.) - it installs everything in the right way.

    http://www.apachefriends.org/en/xampp-macosx.html

  17. dougrdotnet
    Member
    Posted 6 years ago #

    right on! will check it out. thanks

  18. jaxn
    Member
    Posted 6 years ago #

    Ok, this thread was completely un-helpful. If you want the answer to the "error establishing database connection" problem on Mac OS X, here it is:

    The problem is that using localhost has PHP try to connect using a socket at /var/mysql/mysql.sock (which is not where it is on OS X).

    The easiest way to fix this is to use host 127.0.0.1

    Hope that helps.

  19. Asmodeus
    Member
    Posted 6 years ago #

    Wunderbar!
    You fixed my problem as well!

    I recommend the WordPress team place this important tidbit of information somewhere a little more noticeable and, in addition, nominate jaxn for President of the Universe.

    Seconds?

  20. dougrdotnet
    Member
    Posted 6 years ago #

    @jaxn, many thanks - I will mark this thread resolved.

    @Asmodeus, this would have been nice to have in the docs, although i should have figured it out - I was just stuck on localhost since that was what my MySQL config was using.

  21. streichmann
    Member
    Posted 6 years ago #

    It took a long time, supernatural perseverence, and a nasty email chastising this moshu character for his unconstructively difficult non-responses to find this simple, basic workaround. What can we do to make this information readily available as part of the 'Famous 5-Minute Install' (without which '5-Minute Install' is baloney as far as Mac users are concerned...)??? As I told moshu, for every potential blind-faith convert sucked in with the 5-minute promise under-delivered with the paucity of frank documentation on mac implementation, you not only lose the opportunity for an easy evangelist, you run the risk of creating a counter-evangelist fed up with the 'cracks' in documentation/support inevitable with OSS but taken for granted by proprietary solutions........ all in all, not good for business.

  22. searchen
    Member
    Posted 6 years ago #

    Is there a way the solution suggested could be applied to a host server online?

    All of a sudden, I am unable to connect to the database, but the server people say it is running.

    I am at a loss how to continue.

    I have various blogs installed on the same server, all with the same wp 2.5.1, and in fact one that is running on a subdomain. All the databases are set up similarly, but ONE gives me the "database connection" error.

  23. paul
    Member
    Posted 5 years ago #

    Seconding the vote for jaxn as supreme oligarch.

    Now maybe I can work out why permalinks have FAIL written all over them.

Topic Closed

This topic has been closed to new replies.

About this Topic