-
Notifications
You must be signed in to change notification settings - Fork 974
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wp config create ERROR 1045 (28000): Access denied for user #4505
Comments
@apb1963 It appears your More generally, there's not any code that automatically appends 'localhost' to a dbhost, so I suspect this is user error. |
I think you're referencing what appears to be a single hyphen as opposed to double? No, it's a double, that's apparently a copy/paste translation issue with this forum/github.com software. --dbhost has two hyphens. It shows up that way in the preview tab... lets see if it stays that way... |
@apb1963 Happy to help you debug in Slack: http://wp-cli.org/#support |
Hmm. It did.. I don't know why it showed up that way... but there are two hyphens as required. Lets try again: sudo wp config create --path=/usr/local/src/myhost.mydomain --url=https://myhost.mydomain --dbhost=myhost.mydomain --dbname=myhostDBName --dbuser=apb --dbpass=123 --allow-root ERROR 1045 (28000): Access denied for user 'apb'@'localhost' (using password: YES) |
Well after I went through the signup process, I went there, and have been sitting there, but I don't see you. |
Reproducing this bug requires a similar if not identical environment. So, installing ubuntu 16.04.3 is the first step, although skipping this step until later is a possibility. i.e. If you can reproduce without having to install that OS, then you can skip installing it. If not, then installing ubuntu is the only way to accurately attempt reproduction of this bug. The next step to reproduce requires creating the directory. i.e. mkdir /usr/local/src/myhost.mydomain Then, using wp-cli install wordpress into that directory. Then, remove the config file i.e. rm /usr/local/src/myhost.mydomain/wp-config.php or else wp-cli complains (in the next step below) that it already exists and I don't know a way to force an overwrite using wp-cli. Maybe you do. Next, run the given command (sudo wp config create --path=/usr/local/src/myhost.mydomain --url=https://myhost.mydomain --dbhost=myhost.mydomain --dbname=myhostDBName --dbuser=apb --dbpass=123 --allow-root) to recreate the config file (because I have different parameters then the stock config file and I need to change it). Substitute your own existing non-root user for "apb". Note that replacing "apb" with "root" works, but leaves me with the wrong user (root) in the wp-config.php file. Obviously I can post process it with various tools, but I think fixing the bug is the better solution. YMMV |
Why does
If this is the case, then the bug is with Ubuntu and not WP-CLI. |
My guess is that your mysql server |
Hmm... I thought that replying to the email I received would end up posting it here, but apparently not. So I'll paste my emails next... |
On 11/13/2017 04:45 PM, Daniel Bachhuber wrote:
Sorry, I forgot to mention that I copy an existing wp install to the above path, so the wp-config.php is from that copy, which is of course not relevant to the current install. In any event, I remove it before doing anything further. When I first started I didn't know that it would use a cached copy of wp instead of downloading again, so I felt that copying would be more efficient than re-downloading it. I haven't had a chance to go back and change it and I don't think it makes much difference. Let me know if you do, this is what I would do if so, unless it's wrong: The intent is to have a pristine, unaltered site /usr/share/wordpress and then also create a template site under /usr/local/src/template which includes woo, storefront and whatever other plugins, then copy it to another installation site - say maybe for example "onions.mydomain" and change the relevant parameters to match. Although I'm specifying multi-site so far, I don't think I'll actually be using it. I'm trying to plan for the future, with the hope & expectation that the store will be wildly successful. So, towards that end I want each site to have its own DB rather than sharing the same DB, which is what multi-site does if I understand correctly. That way if a particular site gets significant traffic I can move it to its own server without too much hassle I think. That's the current thinking anyway.
With all due respect, I disagree. To use an unrelated and contrived example, (but which should help to clarify my point) if ubuntu requires that you use 'open(filename, "mode")' but you use 'open("mode", filename)' instead because that's how OS-X does it, then the bug is not with ubuntu, as you have failed to provide ubuntu with what it requires. Similarly, if ubuntu adds something to its environment that causes a problem for wp, it's not a bug in ubuntu, it's a failure of the application to acknowledge reality. There are of course exceptions to just about every rule. The problem may very well be something that's different in my environment that I'm unaware of, seeing as I'm relatively new to wp in all its forms. The problem is, I don't know where I should be looking or what I should be looking for. If you say wp doesn't explicitly tack on the @localhost, I believe you. But, that still leaves the question of where the heck it's coming from. ubuntu doesn't just randomly insert things, there's got to be a reason. As the error occurs outside of my script as well as inside, the error can not possibly be with my bash script - i.e. I'm not using the script and still get the error). If you're up to it, I can give you an account on my machine if you think investigating up close would be helpful. I can workaround the problem by using root instead of apb, but then I have to modify the wp-config.php file after it's generated as it stuffs the dbuser (now root instead of apb) into the file. It's not a big deal, a couple of simple sed statements and finished but it's really not how it should be done in my opinion. I guess I can repress my sensibilities if I have to. With all that said --skip-check allows me to bypass the issue. Unfortunately, when I do so, it does not include any of: define('DB_NAME', 'wordpress'); in the file. I can certainly add them to my script easily enough, but I thought I'd mention it since I'm not sure what behavior to expect when using --skip-check. Thank you |
On 11/13/2017 11:58 PM, gitlost wrote:
Thanks for your response. The mysqld server is in fact at localhost and to my knowledge, is correct. You are correct in that apb@localhost does not exist. However, that's the correct answer to a question that wasn't asked. The question was, why is "@localhost" getting tacked on whether I want it or not? apb@localhost@localhost is not a valid user, nor will nor should it ever be. With that said, this is where my inexperience comes in and you've started my brain juice churning and now you've got me wondering if I'm taking the right approach forcing/requiring/expecting the admin to be at the same domain. Perhaps I should simply add apb@localhost as the administrator of myhost.mydomain and xyz@localhost as admin of myhost2.mydomain, and so on. That would circumvent the issue I think. So that might be the easiest work-around until someone can figure out why it's adding @localhost for no apparent reason. I'll give it a try. Thank you! |
You're confusing 2 different users - the mysql user and the WordPress user - and 2 different hosts - the mysql host and your site domain. They have nothing to do with each other. The original error message you got
is a MySQL error and |
I agree with the rest of what you've stated and am aware of it, thank you. But in regard to the above quoted statement... Hmmm. You may have hit the nail on the head. I am in fact a bit confused about that point. Does that mean all I need is root@localhost as my user for all WordPress databases? So I actually don't need different wp-config.php files for each one?? Well actually... I kinda do. If DB1 becomes ultra-popular, I may need to tune the memory limit and/or other parameters for that one DB alone. Right? I guess at that point I'd move that one DB to another server I suppose. Hmmm - I guess it depends on details of the future situation; hard to plan for that. So, following this to its conclusion to specify/assign/create/etc. a different admin for each WP DB (and in truth, I'm not clear at this point what those admins would be doing exactly) I guess I'd use "wp user create" and "wp user add-cap" to create the admin user? And presumably the potential capabilities are documented somewhere. Or maybe it's add-role I need? Guess I have some reading to do. Focused links are appreciated. Thanks for pointing me in the right direction! |
It tacks the @localhost on whether I use a host name or not.
Thank you in advance!
The text was updated successfully, but these errors were encountered: