![]() To avoid the Please explicitly state intended protocol error, use the login_unix_socket argument, for example, login_unix_socket: /run/mysqld/mysqld.sock.Īlternatively, to avoid using login_unix_socket argument on each invocation you can specify the socket path using the `socket` option in your MySQL config file (usually ~/.my.cnf) on the destination host, for example socket=/var/lib/mysql/mysql.sock. If credentials from the config file (for example, /root/.my.cnf) are not needed to connect to a database server, but the file exists and does not contain a section, before any other valid directives, it will be read and this will cause the connection to fail, to prevent this set it to an empty string, (for example config_file: ''). As an example, the default MariaDB installation of version 10.4 and later uses the unix_socket authentication plugin by default that without using login_unix_socket=/var/run/mysqld/mysqld.sock (the default path) causes the error ``Host ‘127.0.0.1’ is not allowed to connect to this MariaDB server``.Īlternatively, you can use the mysqlclient library instead of MySQL-python (MySQLdb) which supports both Python 2.X and Python >=3.5. If there are problems with local connections, using login_unix_socket=/path/to/mysqld/socket instead of login_host=localhost might help. If none are present, the module will attempt to read the credentials from ~/.my.cnf, and finally fall back to using the MySQL default login of ‘root’ with no password. īoth login_password and login_user are required when you are passing credentials. ![]() If you have trouble, it may help to force Ansible to use the Python interpreter you need by specifying ansible_python_interpreter. If ansible discovers and uses Python 2, you need to install the Python 2 version of either PyMySQL or MySQL-python. For example if ansible discovers and uses Python 3, you need to install the Python 3 version of PyMySQL or mysqlclient. You can also use dnf install python2-PyMySQL for newer versions of Fedora see .īe sure you have mysqlclient, PyMySQL, or MySQLdb library installed on the target machine for the Python interpreter Ansible discovers. The Python package may be installed with apt-get install python-pymysql (Ubuntu see ) or yum install python2-PyMySQL (RHEL/CentOS/Fedora see ). Requires the PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) package installed on the remote host. Subsequent runs of the playbook will then succeed by reading the new credentials from the file.Ĭurrently, there is only support for the mysql_native_password encrypted password hash module. To secure this user as part of an idempotent playbook, you must create at least two tasks: 1) change the root user’s password, without providing any login_user/ login_password details, 2) drop a ~/.my.cnf file containing the new root credentials. MySQL server installs with default login_user of root and no password.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |