• I’m putting up a new instance of wordpress (WP) on a system running XAMPP. I defined a new database (DB_NAME) and user (DB_USER) as instructed in installation instructions. wp-config.php was created as instructed with the previously defined values for DB_NAME and DB_USER. When trying to run the wp-admin/install.php an error is produced saying the db connection failed. Message suggests verifying that correct values for DB-NAME and DB_USER have been specified. I can verify that the correct values work with MySQL by using MySQL Workbench to connect using the specified values. Then I change wp-config.php to specify DB_USER=root (i.e., the root user for the MySQL server) instead of the name I setup for the wordpress DB and install runs just fine.

    Based on the above I conclude WP is unable to handle the value that I chose for DB_USER. I did opt to specify a value that used mixed case (some upper and some lower). This seems to be fine with MySQL but possibly not with WP.

    What gives?

Viewing 10 replies - 1 through 10 (of 10 total)
  • Based on the above I conclude WP is unable to handle the value that I chose for DB_USER.

    I question the accuracy of that conclusion. The symptoms seem to suggest that there is still some minor issue with the permissions that your non-root MySQL user has on your WordPress database. The fact that your MySQL root credentials allow the WordPress script to run, and the non-root user fails, only hints at a MySQL issue at this point.

    [edit] just to be clear, you can create a user in MySQL and still open (sign into) a MySQL administration tool with that username and password without ever assigning any permissions to a database for that user, however; in the off chance that your root user has full permissions on the WordPress database, but you forgot to give the non-root user full permissions on the WordPress database, would your results be the same as what you have described? Just guessing, mind you…

    This has just been bugging the crap out of me, so I finally dragged out an old windows box and installed xampp.

    1) I configured the MySQL root password using the xampp security console

    2) used phpMyAdmin to create a database named “wordpress”

    3) created a simple user named ‘peter’ with a password of ‘cottontail’ and assigned that user full privileges on the wordpress database.

    4) Restarted the services and brought up the wordpress install page. Was immediately met with ‘Error establishing a database connection.’

    5) Changed the user name and password to the root account in wp-config, and went back to the install page. The installation proceeded normally under the root account.

    6) opened up MySQL workbench to have a look. Verified that the user was listed, the database was listed, and full database permissions were granted for the user.

    I stopped at this point because my desire to troubleshoot an XAMMP installation is minimal at best. I did however, manage to reproduce the issue using just a simple username and password. If you do find an solution or reason for this, I wouldn’t mind knowing what it was. Probably will turn out to be something pretty simple in the end.

    Good luck to you!

    Thread Starter aajax

    (@aajax)

    When I setup the MySQL user for WP I did grant it all permissions to the WP database. I followed the WP provided installation instructions and chose to use the method described for phpMyAdmin because that fit nicely with XAMPP. Using either phpMyAdmin or MySQL Workbench I can verify that the user I created has full permission from anywhere to the WP database.

    The above suggestion that it simply doesn’t work with XAMPP does provide helpful guidance for future trouble shooting. Thanks for making that finding even if it doesn’t get my system working.

    Thread Starter aajax

    (@aajax)

    It appears as though MySQL does not consider “localhost” to be “any host” (i.e., “%”). By simply defining the same user name (DB_USER) with the same privileges for “localhost” rather than “any host” the problem seems to go away.

    Therefore, I now conclude that the problem is attributed to MySQL idiosyncrasies. However, from a WP perspective it seems that the installation instructions are a bit faulty.

    For whatever it might be worth I’m using XAMPP 1.7.7 which utilizes PHP 5.3.8 and MySQL 5.5.16.

    I made the same discovery last night after searching out discussions about XAMPP on Google. My new user finally worked with “localhost” permissions. I never did get it to work with a MySQL wildcard. But it has nothing to do with WordPress.

    However, from a WP perspective it seems that the installation instructions are a bit faulty

    There’s nothing in this situation that reflects negatively on the WordPress installation instructions or procedure. Seems to me the install script did it’s job perfectly.

    Therefore, I now conclude that the problem is attributed to MySQL idiosyncrasies.

    I’m not sure I’m ready to agree with that conclusion yet. MySQL wild carding is working fine for me on several different servers. Until the same behavior can be verified on the same version of MySQL on a properly configured server (meaning not XAMPP or any of the other pre-built all in one installer packages) or you can find documented verification that this is a normal operational characteristic of MySQL 5.5.16, I’m still casting a suspicious eye at how XAMPP installs and configures its packages. Or, it might be something as simple as taking another look at the selectors in the phpMyAdmin user setup dialog, and possibly discovering some minor detail that was easy to overlook. If I get a chance to take another look, I’ll let you know if I find an answer to the “Any” host or wild carding issue.

    Thread Starter aajax

    (@aajax)

    In the MySQL Reference Manual within Section 6.2.7. Causes of Access-Denied Errors it says –

    “If you cannot figure out why you get Access denied, remove from the user table all entries that have Host values containing wildcards (entries that contain ‘%’ or ‘_’ characters). A very common error is to insert a new entry with Host=’%’ and User=’some_user’, thinking that this enables you to specify localhost to connect from the same machine. The reason that this does not work is that the default privileges include an entry with Host=’localhost’ and User=”. Because that entry has a Host value ‘localhost’ that is more specific than ‘%’, it is used in preference to the new entry when connecting from localhost! The correct procedure is to insert a second entry with Host=’localhost’ and User=’some_user’, or to delete the entry with Host=’localhost’ and User=”. After deleting the entry, remember to issue a FLUSH PRIVILEGES statement to reload the grant tables. See also Section 6.2.4, “Access Control, Stage 1: Connection Verification”. “

    This certainly qualifies for what I was intending to say when using the phrase “MySQL idiosyncrasy”. Since it sounds like this is something under control of the installer it may also be considered an idiosyncrasy of the way XAMPP chooses to configure MySQL.

    @aajax

    That’s some damn fine detective work.

    I don’t know why this didn’t click with me from the get-go. An anonymous account is created by default in every MySQL installation. I run mysql_secure_installation when I set up mysql on a server ( but on windows it’s a script that can’t be run unless you have perl installed so I didn’t even give it a thought). The point is, part of this process removes the “anonymous” user that has access from “Any Host”.

    The default XAMPP installation installs the user “Any”,(rather than Anonymous) with privileges from any host. The rule defined for user “Any@%” is taking precedence over your wordpress user. Using phpMyAdmin to delete the user “Any”, will allow you to assign privileges from any host or ‘%’ to your wordpress user, and things will run just fine. I just tried it myself. Worked great.

    [edit] – correcting a statement (assumption) I made regarding the MySQL secure install script on windows – According to the MySQL 5.5 Reference manual: mysql_secure_installation is not available on Windows. Bummer.

    @aajax

    Well, I certainly have to thank you for all the notes you’ve helped me add to my “XAMPP on Windows” personal file today. This thread has generated some great reference material for my personal notes.

    Re: “According to the MySQL 5.5 Reference manual: mysql_secure_installation is not available on Windows”

    Just for the heck of it, I installed perl (Strawberry) for windows anyway. I opened the perl command console and;

    cd c:\xampp\mysql\bin

    mysql_secure_installation.pl

    The MySQL secure installation script ran just fine in spite of what the reference manual says. Just thought I’d mention it if you decided it might be something you wanted to explore.

    Thread Starter aajax

    (@aajax)

    @claytonjames

    I think we have a solution thanks to your wisdom and guidance.

    You are much too kind. I got off easy, just drinking coffee and beating up an old Windows XP box. You actually did all the research!! Fun stuff.
    ??

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘DB_USER fails to connect’ is closed to new replies.