mysql error 1045: access denied for user root@localhost using password NO

410 views
Skip to first unread message

Antonio Mini

unread,
Mar 26, 2014, 11:25:08 AM3/26/14
to salt-...@googlegroups.com
I'm using the following formula to install mysql-server on an ubuntu 12.04 minion for testing purposes:

mysql-server:
  pkg:
    - installed
    - pkgs:
      - mysql-server
      - python-mysqldb
  service:
    - running
    - name: mysql
    - require:
      - pkg: mysql-server
  mysql_user:
    - present
    - name: root
    - password_hash: 'some_hash'
    - require:
      - service: mysql

On every first run salt installs the mysql-server package and adds the password to the root user.
Every subsequent run gives the following error:

          ID: mysql-server
    Function: mysql_user.present
        Name: root
      Result: False
     Comment: MySQL Error 1045: Access denied for user 'root'@'localhost' (using password: NO)

Should I add something which I am forgetting?
A search on the internet doesn't result in any specific hits concerning the password management of mysql root users with saltstack.

Thanks

pille

unread,
Mar 26, 2014, 1:06:10 PM3/26/14
to salt-...@googlegroups.com


On 03/26/2014 04:25 PM, Antonio Mini wrote:
> mysql-server:
> mysql_user:
> - present
> - name: root
> - password_hash: 'some_hash'
> - require:
> - service: mysql
>
> On every first run salt installs the mysql-server package and adds the
> password to the root user.
> Every subsequent run gives the following error:

have you setup mysql support in salt?
i'm using:
mysql.default_file: '/etc/mysql/debian.cnf'
in minion config.

this is how i successfully setup a user, but i guess the difference
doesn't matter, if the above config is set.

{{ mpcp_mysql_username }}:
mysql_user.present:
- host: {{ mpcp_mysql_host}}
- password: {{ mpcp_mysql_password}}

Antonio Mini

unread,
Mar 26, 2014, 3:24:37 PM3/26/14
to salt-...@googlegroups.com, pille+salt+...@struction.de
Hello pille,

No, I hadn't set it up.
But everything works as it should now.

Thanks for the help!

Op woensdag 26 maart 2014 18:06:10 UTC+1 schreef pille:

Pravin Gaikwad

unread,
Jul 16, 2015, 4:54:34 AM7/16/15
to salt-...@googlegroups.com, pille+salt+...@struction.de
Thank you pille, it worked like a charm!
Reply all
Reply to author
Forward
0 new messages