# mySQL doesnt install on AWS EC2

**URL:** <https://forum.ansible.com/t/mysql-doesnt-install-on-aws-ec2/28690>\
**Category:** Ansible Project\
**Tags:** aws\
**Created:** [October 1, 2018, 1:50am UTC](https://forum.ansible.com/t/mysql-doesnt-install-on-aws-ec2/28690 "2018-10-01T01:50:54Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![adrian\_lee](https://avatars.discourse-cdn.com/v4/letter/a/43a26b/32.png) [@adrian\_lee](https://forum.ansible.com/u/adrian_lee)\
**Post date:** [October 1, 2018, 1:50am UTC](https://forum.ansible.com/t/mysql-doesnt-install-on-aws-ec2/28690/1 "2018-10-01T01:50:54Z")

</div>

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

```auto
  - 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

```auto
[client]
user=root
password=Password123_#

```

Im getting this error everytime

```auto
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?

---

<div class="post-metadata">

**Author:** ![Kai\_Stian\_Olstad](https://avatars.discourse-cdn.com/v4/letter/k/e19adc/32.png) [@Kai\_Stian\_Olstad](https://forum.ansible.com/u/Kai_Stian_Olstad)\
**Post date:** [October 1, 2018, 10:16am UTC](https://forum.ansible.com/t/mysql-doesnt-install-on-aws-ec2/28690/2 "2018-10-01T10:16:34Z")

</div>

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  
&nbsp;&nbsp;&nbsp;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.
