Closed dawi closed 2 years ago
I also have the same problem with debian 10.
I was wondering if adding the -p {{ mysql_root_password }}
is a good idea.
But, it should be easier and better to have a MySQL user which can run MySQL commands without using a password.
Commenting out the empty password =
lines in debian.cnf
resolves any permission problems. (Ie. this role was unable to pass the Remove MySQL test database
step due to allegedly missing permissions (ignoring correct /root/.my.cnf).)
I hope i am not hijacking a different problem, but i had a similar problem as described in the last comment here:
TASK [geerlingguy.mysql : Remove MySQL test database.] *************************
fatal: [localhost]: FAILED! => {"changed": false, "msg": "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials. Exception message: (1698, u\"Access denied for user 'root'@'localhost'\")"}
I tried setting a new root password and also tried it with an empty password. My specs are:
My configuration looks like this:
- role: geerlingguy.mysql
mysql_root_password_update: true
mysql_root_username: root
mysql_root_password: test
# also tried with:
# mysql_root_password: ""
# and:
# mysql_root_password:
The contents of the file /etc/mysql/debian.cnf look like this:
# Automatically generated for Debian scripts. DO NOT TOUCH!
[client]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
[mysql_upgrade]
host = localhost
user = root
password =
socket = /var/run/mysqld/mysqld.sock
basedir = /usr
And the file /root/.my.cnf looks like this:
#
# Ansible managed
#
[client]
user="root"
password="test"
I tried removing/commenting the empty password lines in /etc/mysql/debian.cnf like the previous poster suggested and then i used "vagrant reload --provision", but the same error remained (i also verified that the lines would not get added back by reloading).
What i have noticed is, that if i try to connect from the shell (logged in as vagrant) with "mysql -u root -ptest" or "mysql -u root" it wont work, but if i "sudo su" first, it will work with just "mysql".
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
I can confirm that this issue still persists. At least with this combination:
I haven't found the reason yet, but it appears that MariaDB started blocking connections for the root-user over the host localhost
. In my case I solved this with providing login_unix_socket
to the mysql_user
command.
Here is a config, which worked for me:
- name: Set MariaDB root password for the first time
mysql_user:
name: "{{ mariadb_root_user }}"
password: "{{ mariadb_root_password }}"
host_all: yes
state: present
login_unix_socket: "/var/run/mysqld/mysqld.sock"
This issue is no longer marked for closure.
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
Manually setting login_unix_socket
seems to have solved this for me. Might there be some variable I could set to do something similar?
- name: Remove MySQL test database.
mysql_db: "name='test' state=absent login_unix_socket='/var/run/mysqld/mysqld.sock'"
This issue is no longer marked for closure.
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
Still active and also blocking the mysql upgrade:
Mar 30 11:01:36 vps /etc/mysql/debian-start[757]: Reading datadir from the MariaDB server failed. Got the following error w>
Mar 30 11:01:36 vps /etc/mysql/debian-start[757]: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using pass>
Mar 30 11:01:36 vps /etc/mysql/debian-start[757]: FATAL ERROR: Upgrade failed
MariaDB 10.5.15 on Debian Bullseye
This issue is no longer marked for closure.
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
After installing
MariaDB 10.3
onUbuntu 20.04
via this ansible role, I am getting the following warnings in/var/log/mysql/error.log
:This warnings are caused during execution of
/etc/mysql/debian-start
:The issue could be that passwords configured in
/etc/mysql/debian.cnf
and/root/.my.cnf
don't match.The errors do not occur if I set the
mysql_root_password
to""
like this:But that's nothing I would want to use in production.