-
-
Notifications
You must be signed in to change notification settings - Fork 691
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
Access Denied Error on CentOS 7 #597
Comments
I t looks like chef doesn't created the "root" account with the mentioned password. Not sure how I what parameters in chef recipe can help to create the root account. |
I have updated metadata.rb file to use latest mysql chef cookbook (8.5.1). Two things which I have noticed
[root@rundeck-test cookbooks]# mysql -S /var/run/mysql-default/mysqld.sock -u root ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) [root@rundeck-test cookbooks]# mysql -S /var/run/mysql-default/mysqld.sock -u root -p Enter password: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES) |
Same thing happens to me on Ubuntu 18.04 |
@gangadhar01a @gsomoza is this still happening with the current release of this cookbook? |
I think I'm hitting the same issue on Ubuntu 18.04 using v10.0.2 of the cookbook. What stands out in the Chef output on a fresh machine is the last line and the fact that it's skipped:
I haven't fully dug into this yet, but it's seeming the file whose existence is checked might already been there just from installing the package, so then the setup script never runs: mysql/libraries/mysql_service_base.rb Line 95 in 844036b
The could be related to using a service instance name of "default", which then looks in /var/lib/mysql for mysql/user.frm, which the package may install, tricking the cookbook into thinking it already did it's setup. I'll see if I can dig in and clarify this further to find a fix. |
Weird, it's working for me on version 10.0.2 right now. We're not using a DB setup script though. MySQL Cookbook version: 10.0.2 UPDATE: oh wait, forgot to enable the installation of mysql-server 🙂. Will test that now.
|
That error is likely coming from the end of the conditional here: mysql/libraries/mysql_service_base.rb Line 126 in f7c92af
I hit a similar issue as it seemed like node.default['apparmor']['disable'] = true But I agree I think that's a bit tangential to this main issue. Also to clarify, I'm not intentionally using a DB setup script, that's just a side effect of the |
This looks like the same issue reported in #660 but I was unable to replicate it on my end. Can you provide some example code so I can try and do that on my end? |
I would agree @gsomoza hit the same issue in #660, but I think that's unrelated to the original issue reported by @gangadhar01a which @gsomoza confirmed back in May then I hit yesterday, which I believe boils down to the initial DB setup not being run, potentially when the instance is named "default", which might be because the package install creates the file this cookbook is looking for to determine if it already initialized the DB or not. |
Digging further into this, I'm pretty sure I quoted the wrong output line before, this is where setting the root password is skipped when the instance name is "default" on a fresh machine:
As I linked to before, I'm pretty sure the package install is creating the file that we're checking to see if "default initial records" needs to run, and as a result, it doesn't run, so doesn't set/change the root password, hence @gangadhar01a 's initial issue, likely. It's almost like if the package is installed, you'd first have to completely clean up the server it creates initially, then proceed with whatever service is specified by the recipe, treating a service named "default" more as a fresh start, rather than applying over the package installed service. |
@cgunther I just released a few fixes, can you see if this problem still exists with the latest version released? |
I think I fixed my problem, but unrelated to your recent fixes. Digging further into this, I think my trouble was that at least on Ubuntu 18.04/MySQL 5.7, the root user seems to be set up out-of-the-box using the auth_socket plugin, which means so long as you connect via the root OS user, the connection is permitted. The root password doesn't seem to matter, so long as the OS user matches, passing a password or not to the I still think the cookbook isn't actually setting the root password (at least when the instance is named "default"), but I think that's moot because the auth_socket plugin doesn't seem to involve passwords for authentication. Thanks for going on this adventure with me, though. |
Due to problems with root authentication method on Ubuntu Ref: sous-chefs/mysql#597 (comment)
I am using the following resource which has installed and started the required mysql version. Unfortunately, I am getting Access Denied error when I tried to access mysql as a root.
"mysql_service 'default' do
initial_root_password 'abc123'
bind_address '0.0.0.0'
port '3306'
version '5.7'
action [:create, :start]
end"
[root@rundeck-test cookbooks]# mysql -S /var/run/mysql-default/mysqld.sock -u root -h localhost -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
The text was updated successfully, but these errors were encountered: