Hello,
Have anyone attempted to use ansible to create database on mariaDB system recently. I am having a problem and would appreaciate advice.
I have two tasks:
-
name: create nextcloud database schema
mysql_db: name={{database_name}} encoding=utf8mb4 collation=utf8mb4_bin state=present login_user=root login_password=“{{root_db_password}}” -
name: add nextcloud database user
mysql_user: name={{mysql_username}} password={{mysql_password}} priv=‘{{database_name}}.*:SELECT,INSERT,UPDATE,DELETE,DROP,CREATE,ALTER,INDEX,REFERENCES’ state=present check_implicit_admin=yes
They run fine if I am using mysql but are broken when the database is Maria. They fails with this error:
TASK [nextcloud : create nextcloud database schema] ***************************************************************************************************************************************************************
fatal: [nextcloud.eng.perasotech.com]: 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: YES)")”}
The thing is, I do have /root/.my.cnf and infact can login to mysql without password. There is a slight difference when I login manually though and I suspect its what is causing me the pain. See below at the differences, the first being mysql and the other two sessions being MariaDB
Would you know what happening here by any chance? Would really appreaciate your help.
[root@oxygen ~]# mysql -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 87077
Server version: 5.7.26-log MySQL Community Server (GPL)
Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
exit
Bye
[root@oxygen ~]# exit
[root@nextcloud ~]# mysql -u root
ERROR 1045 (28000): Access denied for user ‘root’@‘localhost’ (using password: YES)
[root@nextcloud ~]#
[root@nextcloud ~]# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 16
Server version: 10.3.11-MariaDB-log MariaDB Server
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]>
Regards,
William