Code Monkey home page Code Monkey logo

Comments (17)

dixhuit avatar dixhuit commented on June 16, 2024 1

Still experiencing this bug with Ansible 2.0.1.0.

Setting mysql_root_password_update to yes as suggested above seems to work.

from ansible-role-mysql.

boukeversteegh avatar boukeversteegh commented on June 16, 2024

I have the same error. I have an existing mysql database, and wanted to run this role to ensure that the correct tables and users exist, but it fails on this task

from ansible-role-mysql.

scil avatar scil commented on June 16, 2024

i have the same error. this is the first time i use this role.

TASK: [geerlingguy.mysql | Get list of hosts for the anonymous user.] *********

failed: [localhost] => {"changed": false, "cmd": ["mysql", "-NBe", "SELECT Host
FROM mysql.user WHERE User = \"\""], "delta": "0:00:00.024041", "end": "2015-06-
15 12:23:12.498852", "rc": 1, "start": "2015-06-15 12:23:12.474811", "stdout_lin
es": [], "warnings": []}
stderr: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using pas
sword: NO)

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 16, 2024

I'm now sometimes getting:

TASK: [geerlingguy.mysql | Get list of hosts for the root user.] ************** 
failed: [drupaldev] => {"changed": false, "cmd": ["mysql", "-NBe", "SELECT Host FROM mysql.user WHERE User = \"root\" ORDER BY (Host=\"localhost\") ASC"], "delta": "0:00:00.004044", "end": "2015-06-19 19:29:25.622041", "rc": 1, "start": "2015-06-19 19:29:25.617997", "stdout_lines": [], "warnings": []}
stderr: ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

If running the playbook when MySQL was never started correctly (e.g. first provisioning/boot didn't actually start MySQL for some reason).

It seems the following task (which reports ok on my environment) is not actually ok; or else maybe MySQL is not listening on a socket/port correctly...

- name: Ensure MySQL is started and enabled on boot.
  service: "name={{ mysql_daemon }} state=started enabled={{ mysql_enabled_on_startup }}"

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 16, 2024

I think this could be a bug with Ubuntu 14.04 (and possibly 12.04) service handling with Ansible's service module in 1.9.1. Going to downgrade to 1.9.0.1 and see if it's cleared up...

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 16, 2024

This particular bug just seems to indicate that MySQL needs a restart (at least in the few cases I've seen it happening)β€”most often because MySQL is listening only on at TCP port, and needs to be restarted to listen on a socket.

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 16, 2024

And note that simply switching to Ansible 1.9.0.1 has fixed all the issues for me. 1.9.2 should also work, but it's still only in rc1 status (See: https://groups.google.com/forum/#!topic/ansible-devel/jfm6pZSLUYY).

So as a workaround, please do the following (if you installed Ansible with pip):

sudo pip uninstall ansible
sudo pip install ansible==1.9.0.1

Hopefully that solves the problem for others until Ansible 1.9.2+ is released!

from ansible-role-mysql.

mglaman avatar mglaman commented on June 16, 2024

Just chiming in for others who arrive here: having some issues on ubuntu 14.04 and packer.io builds, giving downgrade a whirl as @geerlingguy mentioned.

from ansible-role-mysql.

rvanbaalen avatar rvanbaalen commented on June 16, 2024

Im experiencing this issue on Ansible 1.9.3

from ansible-role-mysql.

geerlingguy avatar geerlingguy commented on June 16, 2024

@rvanbaalen - Can you try setting mysql_root_password_update to yes in your variables, and see if that makes this work?

from ansible-role-mysql.

builtbybrayne avatar builtbybrayne commented on June 16, 2024

I'm also getting this.

TASK: [geerlingguy.mysql | Get list of hosts for the anonymous user.] *********
failed: [54.194.51.168] => {"changed": false, "cmd": ["mysql", "-NBe", "SELECT Host FROM mysql.user WHERE User = \"\""], "delta": "0:00:00.004040", "end": "2016-03-24 17:47:36.733753", "rc": 1, "start": "2016-03-24 17:47:36.729713", "stdout_lines": [], "warnings": []}
stderr: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

I have tried the following configurations and all 3 generate this error:

Basic config:

overwrite_global_mycnf: yes
mysql_databases:
  - name: <mydbname>
    encoding: utf8
    collation: utf8_general_ci
mysql_users:
  - name: <myusername>
    host: "localhost"
    password: <myuserpassword>
    priv: "<mydbname>.*:ALL"
mysql_enabled_on_startup: yes

Adding root mysql_root_password:

mysql_root_password: <myrootpassword>

And then adding mysql_root_password_update: yes

mysql_root_password: <myrootpassword>
mysql_root_password_update: yes

I'm using the most up-to-date ansible as provided by brew.

$ ansible --version
ansible 1.9.3

In between attempts I killed mysql by running:

#! /bin/bash

sudo service mysql stop
sudo apt-get purge -y mysql-server mysql-client mysql-common mysql-server-core-5.5 mysql-client-core-5.5
sudo rm -rf /etc/mysql /var/lib/mysql
sudo apt-get -y autoremove
sudo apt-get autoclean
sudo rm ~/.my.cnf
sudo rm -r /etc/mysql/

I'll keep trying to find a solution, but if you have a suggestion that would be great. I'll post if I work it out.

from ansible-role-mysql.

dixhuit avatar dixhuit commented on June 16, 2024

@perchten Maybe try installing Ansible via pip rather than brew? That way you can go higher than v1.9.3 (v2 is now latest stable).

from ansible-role-mysql.

builtbybrayne avatar builtbybrayne commented on June 16, 2024

will try that - have had pain-in-the-ass issues with pip before. But that's unrelated.

Just wanted to say, a restart of mysql server just before that task had no impact. Just fyi.

from ansible-role-mysql.

builtbybrayne avatar builtbybrayne commented on June 16, 2024

Upgraded to 2.0.1.0. No luck. Still the same error as I posted above.

What sticks out for me is that the error is for root access without password (Access denied for user 'root'@'localhost' (using password: NO)). Surely, given that this follows the tasks which set the root password, this call should be using the password?

I suggest reopening this issue. The offered solution is just a workaround, and now there's evidence it doesn't work in all cases.

from ansible-role-mysql.

niccolox avatar niccolox commented on June 16, 2024

I am getting the same error on Travis Ubuntu Trusty vm and not on Vagrant Trusty

so, nice and obscure for sure

this is my play, which does not work


  • hosts: localhost
    remote_user: root
    become_user: root
    become: yes
    become_method: sudo
    vars:

    Use default log file size so Travis CI VM allows MySQL restart.

    • mysql_innodb_log_file_size: "5M"
    • mysql_root_username: root
    • mysql_root_password: root
    • mysql_root_password_update: yes
      roles:
    • role: geerlingguy.mysql
      become_user: root
      become: yes
      become_method: sudo
    • role: getvalkyrie.drush
    • role: ansible-role-aegir

from ansible-role-mysql.

Marian0 avatar Marian0 commented on June 16, 2024

Same error here using Ubuntu 16.10 x64

from ansible-role-mysql.

panickervinod avatar panickervinod commented on June 16, 2024

Same error using Ubuntu 16.04, able to login interactively , using mysql -u root -p
but fail in the playbook and also if I try mysql -Nbe ...

from ansible-role-mysql.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.