• Resolved mathan54

    (@mathan54)


    Hi,
    I am installing wordpress. I edited the wp=config file. I put the keys in. I made a user and database. Then I went to localhost/wordpress and localhost/wordpress/wp-admin both said the same thing. Error establishing connection database. I triple checked the edits to the wp-config file. I rechecked the user and the database and password for the user. I’m at a loss.

Viewing 15 replies - 1 through 15 (of 17 total)
  • Moderator t-p

    (@t-p)

    Error connecting to your database:
    In nutshell, you’re getting this error because WP is unable to establish a database connection. Reason why WP is unable to establish a database connection can vary. It could be that your database login credentials are wrong or have been changed. It could be that your database server is unresponsive. It could be that your database has been corrupted. Majority of the times this error happens because of some sort of server error. Also, there could be other factors as well. To troubleshooting this problem:
    – double check your wp-config.php file settings for the database name, database username and database password, and the host name (e.g., “localhost” Vs. something else). This is where most errors occur.
    – Then make sure wp-config.php is in right location.
    – Then check that you don’t need to change the database host from “localhost” to something else. You can get that info from your hosting provider.
    – Check you have actually created a database with the same database name as is in your wp-config.php file.
    – Last, but not least, if all that information is correct your database probably has a problem with it. Contact your hosting provider if the database server is offline (if the problem suddenly happened), or if they have any other problem at their end, or they made any changes to your account, or if there are any limitations/restrictions, or if the hosting package is set to Windows and not Linux, etc.
    – If the error is intermittent then it’s your server. What’s happening is that the web server and/or the database server are gettign overloaded and the connection is droping out or is refused for a short time. That gives you the database error as the website can’t connect to the database. To fix this, you’ll need to talk to your hosting company as they are the only ones that can do anything about hardware issues like this.
    – There are also many threads on this topic on these forums: http://wordpress.org/search/Error+establishing+a+database+connection?forums=1

    Thread Starter mathan54

    (@mathan54)

    I guess you don’t understand what localhost means. It means that I am on my computer. The database, Mysql, is on my computer. Apache 2.4.16 is on my computer. PHP 5.6 is on my computer.
    I created a database for wordpress in the database then I created a user. I put these into wp-config.php. I have no reason to move wp-config.php. It is in that folder for a reason.
    I installed wordpress a few days ago with no problem. I had to uninstall it because I forgot the admin password.
    The database is working I can get in using root. I can type commands and get a response. I can use phpinfo and get a response in Apache.
    Is this more clear?

    Much more clear… try always giving as much information as you can, since ‘localhost’ is also used internally in online servers. That’s what Tara was explaining to you.

    There are several articles online that can help you troubeshoot this error… I don’t know how much you researched, but here is something to try:

    – Create a new user in the DB, with full permissions and use this credentials to install WP.

    Also, if you forget your password, there are other ways of restoring/reseting it, see:

    https://codex.wordpress.org/Resetting_Your_Password#Through_MySQL_Command_Line

    Hope you can figure it out. See ya.

    Thread Starter mathan54

    (@mathan54)

    I did that. I have 2 users attached to the wordpress database. I tried both with changes in wp-config. I even tried root!
    I got a piece of ransomware in Microsoft Edge. I contact Support they suggested that I create a new user with admin privileges. I am wondering if this problem is related to that where I installed everything under my original user and then switched to the new user.
    I have never used a hosting company. Tara should not have assumed that I was. I know many people here are doing so, but I am a do it yourselfer. by assuming I use a hosting company all she did was waste her time. She could have asked.
    I have insomnia, so I don’t always remember everything I need to do.

    Thread Starter mathan54

    (@mathan54)

    I clicked on the link that Tara provided but was of no use. I did not recognize my problem in the over 2 dozen different links.

    Hello mathan, my 2 cents:

    It’s possible you run both Apache and IIS on same computer (server in that case), thus both will enter in conflict if they try to use same http port to become server (80 by default). Try disabling IIS, for example and test, or change its port (to 1234 for example). In general you need to reboot computer/server to test changes (not plug & play).

    Thread Starter mathan54

    (@mathan54)

    I don’t have IIS installed. On windows 10 you have to go to turn on and off windows features. I did not do that. I did do a netstat -anb and found httpd on 0.0.0.0:135. I can do a phpinfo(); Apache does not like php_mcrypt and mhash. It says that they are not valid win32 files. However I install Apache 2.4.zip over a working Apache 2.2 install. The I installed PHP 5.6 over a PHP 5.2.9 install.
    By over I mean that I unzipped these files into their corresponding folders. It was a successful way of getting the most recent versions of PHP and Apache running. More like a stroke of luck!

    Hi again,

    MMM, no problem for mcrypt and mhash, they are in general a bit touchy with no overall trouble (even on ubuntu lts).

    But be careful don’t overwrite 32-bits and 64-bits server code on same directories… possible wreckage! and I don’t mention servers running… all services MUST be OFF while you do that kind of bulk copy…

    Thread Starter mathan54

    (@mathan54)

    oopppsss. I think I installed apache and php whilethe apache service was running. What kind of problem would that create?

    Tons of bugs. Like you described on top.
    More importantly, it’s a miracle if you can display any local webpage from your hard drive – and that shows more or less straight.

    How does it go now please?

    Just to know if the topic can be closed?

    cek your (local) server setting

    Thread Starter mathan54

    (@mathan54)

    I fixed it.

    Moderator t-p

    (@t-p)

    Glad to know it šŸ™‚

    i have the seam problem

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘WP install cannot connect to DB’ is closed to new replies.