WordPress.org

Forums

Error Establishing Database Connection (24 posts)

  1. holtzheimer
    Member
    Posted 8 years ago #

    After about 3 days of trying and many efforts from zipa.com tech support, I still cannot get the wp-config.php file to open my database. I've sent all this information to zipa.com tech support and they keep giving me suggestions and I keep doing them. However, still,

    when I run my wp-config.php I get:

    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 z-1234.zipa.com. 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?

    Anyone have any further suggestions?

  2. holtzheimer
    Member
    Posted 8 years ago #

    Yep, This WordPress Famous 5-Minute Installation, has taken me about three days so far. I'm beginning not to be very impressed.

  3. DianeV
    Member
    Posted 8 years ago #

    Sorry you're having a problem.

    Actually, the 5-Minute install *does* work very quickly -- but only IF (a) the database has already been set up on the web hosting account, and (b) the right data has been input in the config.php (and uploading it to the server).

    If your web host set up a mysql database for you, then it's a matter of inputting the right data in the config.php.

  4. Billk
    Member
    Posted 8 years ago #

    You know, I have the same issue. I tried to go to install4 free and was directed to http://codex.wordpress.org/Mailing_Lists#Professional. Lots of good that did.
    Checking again, my host says that the sql database name is correct and I've rechecked all my other data in config.php. Nothing seems to be working.
    If there is anyone out there that can provide some assistance, I sure would appreciate their contacting me/us!

  5. moshu
    Member
    Posted 8 years ago #

    You were probably directed "away" because your site seems to be a business site amd the free install is only for personal blogs.
    I didn't see your post on the wp-pro mailing list asking for help.

  6. presskel
    Member
    Posted 8 years ago #

    One of the most frustrating experiences is to be constantly checking and rechecking the information you enter into the config.php file and seeing that it is correct...YET, the annoying error message about being unable to contact database stays in your face.

    Will someone please help with the reason why this persists even after trying for hours?

  7. presskel
    Member
    Posted 8 years ago #

    Another idea has popped up.
    I seem to recall that recently, when I registered this website, they might have mentioned that all scripts should be placed in the cgi-bin folder.
    Might this be a part of the error problem if we instal the scripts to the root folder instead of into the cgi-bin folder?

  8. danfresh
    Member
    Posted 8 years ago #

    Hello,

    I just now got past this problem after a long time of annoyance. My problem was a syntax error, and if you do not spend much time writing code,(I rarely do) then it is probably just that (if you do, then forgive me). This site helped a lot under editng wp-config problem:
    http://codex.wordpress.org/Editing_wp-config.php

    hope this helps,
    dan

  9. moshu
    Member
    Posted 8 years ago #

    Another common error that results in the Cannot connect to the database... message: not adding the DB user to the database.
    In many site admin interfaces just creating the user for the database is NOT enough - you need to ADD the user to the database.

  10. aaronfay
    Member
    Posted 8 years ago #

    Agreed, moshu...
    I have installed dozens of WP sites on different hosts and the only issues I've encountered are my own errors. Failing to set up the proper user has been the issue a number of times. I would recommend downloading WAMP5 (if you're a Windows person),installing the local webserver and testing locally if you are getting into WP installs and modifications. This will allow you to make changes and test very quickly instead of the constant remote testing frustration. It may also lend objectivity to the scenario.
    Cheers,
    Aaron

  11. jylitalo
    Member
    Posted 8 years ago #

    Version: wordpress @2.0.4_0 (active)
    Platform: Mac OS X 10.4.8
    Installation media: macports
    Dependencies:
    apache2 @2.2.2_1 (active)
    mysql5 @5.0.27_0+darwin_8+server (active)
    php5 @5.2.0_0+apache2+darwin_8+macosx+mysql5 (active)

    Steps:
    - mysql passwords changed
    - 'create wordpress' command given
    - symlink created from my DocumentRoot/blog to wordpress
    - 'AddType application/x-httpd-php .php' added into httpd.conf
    - wp-config.php command has been edited
    - phpinfo checked to verify that mysql is supported

    Problem:

    When I try to access http://myserver/blog/wp-admin/install.php, I get 'Error establishing a database connection' blah, blah, blah.

    If I try to run 'php install.php' from command line, it would be more than glad to continue into second step. If I try to access wordpress with "mysql5 -u root -p -h localhost wordpress" from command line, all works beatifully.

    Any ideas?

  12. jamesdiss
    Member
    Posted 8 years ago #

    Create the following script, save as 'dbTest.php', upload to your host and view in the browser.

    Replace the host, user & password fields with your information.

    <?

    if ($cn = mysql_connect("host", "user", "password")) {
    echo "connected";
    } else {
    echo "not connected - " . mysql_error();
    }

    ?>

    You should see the error message being thrown by the server.

    Usually this can be a DB client mismatch. I'd patch the error message produced by the install, but it's trivial to step around and roll your own.

    Enjoy,
    James

  13. jylitalo
    Member
    Posted 8 years ago #

    Thanks James!
    It seems that it was classical case.
    Web application was unable to connect into mysql through /opt/local/var/run/mysql5/mysqld.sock

    Problem was solved with chmod o+x /opt/local/var/run/mysql5

  14. msheean
    Member
    Posted 8 years ago #

    I got it working by changing the entry for localhost to the ip 127.0.0.1. Try that if you are having this problem.

  15. armymomnj
    Member
    Posted 8 years ago #

    I just had the same problem when upgrading to the lastest version. I went in thru my cpanel into the database and created a new user and added that user to the database, put that info in the wp-config.php file and uploaded that and bingo... my site came back :)

  16. texaslsg
    Member
    Posted 8 years ago #

    Hi

    I've download WAMP5 and followed the directions through to no avail. It says it just can't connect to 'localhost' -- I've tried loading, then deleting, then creating, then loading the database and username (together and separately) for an hour or two now. I'm about to lose my mind

    The WAMP server is online, and all services are running. What am I missing?

    Best,
    austin

  17. VladSavitsky
    Member
    Posted 8 years ago #

    Hi
    I have got message "Error establishing a database connection" too.
    I have read a lot of docs... and found solution:
    My hoster put database server at another PC with different IP.
    This means that nor localhost, nor direct IP of my server as db_host not worked.

    Nice!

  18. eliarivero
    Member
    Posted 8 years ago #

    Hello from Canary Islands (Spain),

    First of all, I am sorry for my english, it is very bad.

    I am trying to install WPMU, but I always have the same error "Error establishing database connection".
    I am sure that DBName, DBUser and DBPassword are correct, I can access database with a front-end (SQLYog).
    I have my own webserver, and I want to install WPMU because I want to give multiblog-service to my users.
    I have read a lot of documentation about installation of WPMU and all of them said to delete wp-config.php and run the index-install.php, but always is the same, I don't know what to do, please help.

    Thanks,
    Elia Rivero

  19. Gong
    Member
    Posted 7 years ago #

    I too have spent a few days trying to configure this thing.

    Here are some problems and their resolve:

    1) First the zip program unloaded all of the files into one folder, so path names became invalid:
    Resolve: I used WinRar to unzip - got that tip in these forums - thanks!

    2) Files were missing after the FTP upload. Probably due to a time out or break in connection.
    Resolve: Checked files and uploaded missing files.

    3) The database I created had a different name to the directory I had created. Now this may sound really basic, but I was getting exactly the same error messages that were mentioned here. I re-checked installation procedure and nowhere does it say that the database name should be the same as the directory name - eg if WordPress was uploaded into your directory as /blog, then the database should be called 'blog' - well I am assuming this, because when I created a new database called 'blog' KAZAAM! I got a welcome message!
    Resolve: make sure database and directory name are the same - I think.

  20. moshu
    Member
    Posted 7 years ago #

    Resolve: make sure database and directory name are the same - I think.

    False.
    It doesn't matter what the name of the database is. I have the strangest DB names you can think of :) - and they always work.
    Probably, the second time you didn't make a mistake that you certainly did during the first trial.

  21. rajkum1987
    Member
    Posted 7 years ago #

    I Am Getting Following Error

    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 sql2.hosting.1-2.in. 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.
  22. kellsborojack
    Member
    Posted 7 years ago #

    I've had the same problem. My web hosting techies wrote a little script similiar to the one above and it connects to the database. They even changed the password of the user just in case I was doing something wrong.

    I thought it might be something to do with the same problem mentioned by jamesdiss but the script doesn't through any error messages.

    I'm really stumped now. And very frustrated.

  23. kellsborojack
    Member
    Posted 7 years ago #

    Cracked it !

    In the end I had to copy my backed up WordPress files to the server but I left the database blank.

    I then ran the install program (install.php) which populated the database with tables.

    Using phpMyAdmin I deleted a table one at a time from the database and imported the corresponding table from a database backup. I did this until I imported the table that was causing the error message. This was the wp_options table. I'n not sure which part of the table was causing a problem.

    I then deleted all the tables, repeated the install program and re-imported all the tables except wp_options.

    The drawback to this was I had to re-configure my sidebar modules but with the site being down nearly three weeks I was just grateful to have something to work with.

  24. higgis
    Member
    Posted 7 years ago #

    I had exactly the same problem on Mac OS X Leopard. If I used localhost as the address of the DB, it didn't work, while if I used 127.0.0.1 it did work.

    Hope that helps.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags