WordPress.org

Ready to get started?Download WordPress

Forums

Database Connection Problem (9 posts)

  1. chevychick89
    Member
    Posted 8 years ago #

    I don't know what I am doing wrong... I have changed every value I can think of and went through the tutorial thing that was posted in the other post similar to this. Here's my information:

    cPanel: V.10
    Specs: Windows XP with Internet Explorer
    URL of site: http://lauren-conrad.net
    Host: Surpass Hosting
    And newest version of WordPress (just downloaded it about 2 hours ago)

    I have my config file under the admin folder in http://FTP... all the values for my database and username match the ones in mySQL on it... I don't know what's going wrong. I have granted myself all priveledges in the wordpress database I created and everything. Ah. Anyone have any idea?

  2. moshu
    Member
    Posted 8 years ago #

    Did you add the user to the database?
    http://www.tamba2.org.uk/wordpress/cpanel/
    See the really important bit!

  3. chevychick89
    Member
    Posted 8 years ago #

    Yes I said that. I added it and gave all priveledges.

  4. moshu
    Member
    Posted 8 years ago #

    Then from the cPanel > Mysql page copy here the line it gives you for Pearl and PHP.

  5. DreamMaster
    Member
    Posted 8 years ago #

    We suffered from this same situation on our website. We believed it to be damaged database tables from a recent purging of old accounts from the server our site was on. We waited a couple days for them to fix their mySQL server, but then decided to work on our site to understand the problem better. We could see the database, and eveything was right, yet we still got the database connection error.
    Eventually we loaded the file http://*oursite*/readme.html file to ensure that the server http service was working properly. The very next thing we did was load http://*oursite*/wp-admin/admin.php
    The administration panel was working perfectly, and immediately our site was working normally. We have no explanation why loading admin.php made our problem go away.

  6. chevychick89
    Member
    Posted 8 years ago #

    Moshu you said to copy it and put it where I am confused...

    And DreamMaster I don't really understand what I am supposed to do to do the same thing that enabled yours to work. I don't really know what I should do.

  7. moshu
    Member
    Posted 8 years ago #

    What I said: if you really followed that tutorial and did what it says, then you can go into your cPanel > click MySQL Database and you should see something like:
    database_name
    Users in name
    user_name (Privileges: ALL PRIVILEGES)
    Connection Strings
    Perl $dbh = DBI->connect("DBI:mysql:database_name:localhost","user_name", "<PASSWORD HERE>");
    PHP $dbh=mysql_connect ("localhost", "user_name", "<PASSWORD HERE>") or die ('I cannot connect to the database because: ' . mysql_error());
    mysql_select_db ("database_name");

    I said, copy here what you have.
    If you don't see anything like this - go back to the tutorial and read the Really Important Bit :)

  8. DreamMaster
    Member
    Posted 8 years ago #

    I just looked at your website and you appear to have a problem with your account username and password in your mySQL database that needs to be resolved.
    We had this problem too, and had to delete the account in mySQL in cPanel, not the database, just the user in the database that wordpress uses. Then we added a new user account using the same name and password in our wp-config.php file. That solved the username and password issue for us.
    At this point ourwebsite still did not work and we eventually loaded http://*oursite*/wp-admin/admin.php in a web browser and that fixed our site.
    Your site may likely work immediately after you setup a proper user in your mySQL database.

    One thing to note, in user and password when setting up the new user, our site affixed soemthing like "user_" to the front of our account name. So if the username in your wp-config.php file is like "user_wordpres" you may only have to type "wordpres" to get the username right in your mySQL database. Just make sure the password is exactly like what it is in your wp-config.php file.

    If need be I can walk you through looking at your wp-config.php file and setting up your mySQL user account under your database.

  9. moshu
    Member
    Posted 8 years ago #

    So if the username in your wp-config.php file is like "user_wordpres" you may only have to type "wordpres" to get the username right in your mySQL database.

    That's usually NOT the case in cPanel, but quite the opposite: you need the siteusername_databasename and siteusername_mysqlusername combination to make it work.

Topic Closed

This topic has been closed to new replies.

About this Topic