Support » Installing WordPress » Error establishing a database connection

  • Resolved AcousticBlue

    (@acousticblue)


    OK, I know this post has been made 1000x probably, but I cannot find a search function for this forum…and, well, I think I’ve tried everything I can find to fix this.

    Anyway, I am sure my name/pass/db name are correct in the install.php file. Additionally, I am almost certain that localhost is correct for the Host…

    I am running Apache on Mac OS X.5.6 Server. Additionally, I am using MAMP for mySQL and PHP…

    So far I have tried capitalizing Localhost, changing the socket info in the mySQL_socket in the php.ini file to tmp/mysql.sock and var/mysql/mysql.sock, I have tried using localhost:portnum, and I have tried using the SQL command OLD_PASSWORD with my wordpress user. All to no avail. Are there other possibilities that could be causing this?

    Please, this is driving me nutz!!! 😉
    Thanks in advance,

Viewing 6 replies - 1 through 6 (of 6 total)
  • This search:
    http://www.google.com/search?q=wordpress+++WordPress+›+Support+»+Installation++Error+establishing+a+database+connection+mamp

    found, among others, this:
    http://foolswisdom.com/mac-wordpress-error-establishing-a-database-connection/

    Please let us know what solves your problem.

    Note: the search for the forums is just above the Download tab at the top of my screen.

    Thanks for the search info…

    Ok, this was FINALLY resolved with another solution I finally found in only one place. Here it is…

    For the Host, you have to put localhost:/Applications/MAMP/tmp/mysql/mysql.sock

    I.e, for the port, put the path to the socket…no idea why this one thing works…

    thanks all,

    AcousticBlue, thanks for sharing the solution!

    Yeah, my foolswisdom post is not for MAMP.

    Your solution suggests that you could also solve it be updating php.ini:
    mysql.default_socket = /Applications/MAMP/tmp/mysql/mysql.sock

    That is probably a better solution as it should fix all PHP/MySQL apps.

    There is another solution at http://www.fischerlaender.net/apple-mac/mac-os-x-trouble-with-mamp-mysql

    None of these worked for me… Does anyone have a better solution. I still cannot connect to database: Error establishing a database connection.

    My dbname, username and password are ok. But with local host I have problems

    I already tried all of the above mentioned solutions and the following localhost names:

    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘localhost:8889’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘Localhost’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘Localhost:8889’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘/tmp/mysql.sock’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘/Applications/MAMP/tmp/mysql/mysql.sock’);
    /** MySQL hostname */
    define(‘DB_HOST’, ‘Localhost:8889’);

    I’m really puzzled 🙁

    …and of course
    define(‘DB_HOST’, ‘localhost:/Applications/MAMP/tmp/mysql/mysql.sock’);

    didn’t also work.

    After the whole night (in the morning) find out that I was editing the wrong file…
    Dumb us me.

    Now it’s all working fine and it wasn’t the problem in the first place.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Error establishing a database connection’ is closed to new replies.