mySQL doesnt install on AWS EC2

47 views
Skip to first unread message

adrian lee

unread,
Sep 30, 2018, 9:50:54 PM9/30/18
to Ansible Project

I have 2 EC2 server instances where 1 I am using ansible to install mysql on the other ec2 instance.

ISSUE TYPE

Bug Report

COMPONENT NAME
  • Installing mySQL on AWS EC2 Linux
ANSIBLE VERSION

ansible 2.6.5

CONFIGURATION

So this is what I have so far

  - hosts: database
  sudo: yes

  tasks:
    - name: Install mySQL repo
      yum: name=http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm state=present

    - name: Install mySQL
      yum: pkg={{ item }}
      with_items:
        - mysql-community-server
        - mysql-community-client
        - MySQL-python

    - name: start mySQL service
      action: service name=mysqld state=started

    - name: copy my.cnf
      template: src=.my.cnf dest=/root/.my.cnf owner=root mode=0600

    - name: Create database user
      mysql_user: name=bob password=12345 priv=*.*:ALL state=present login_user=root login_password=Password123_#

And this is my .my.cnf

[client]
user=root
password=Password123_#

Im getting this error everytime

fatal: [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: (1045, \"Access denied for user 'root'@'localhost' (using password: NO)\")"}
        to retry, use: --limit @/etc/an
OS / ENVIRONMENT

Linux AMI

Is this supported on EC2 AWS?

Kai Stian Olstad

unread,
Oct 1, 2018, 6:16:43 AM10/1/18
to ansible...@googlegroups.com
On 01.10.2018 03:50, adrian lee wrote:
> Im getting this error everytime
>
> fatal: [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: (1045, \"Access
> denied for user 'root'@'localhost' (using password: NO)\")"}
> to retry, use: --limit @/etc/an

This says it all, you don't have permission to login as root against
localhost.

The root user is probably using socket and not username/password, you
can always check with
select user,plugin from mysql.user;

You should probably read up on Mysql authentication and seek help in a
Mysql forums for information about how Mysql works.

--
Kai Stian Olstad
Reply all
Reply to author
Forward
0 new messages