Skip to content

MySQL fails to start when mysql_datadir is set to anything other than MySQL's defaultΒ #510

Open
@liammcdermott

Description

@liammcdermott

Our Ansible playbooks use this role and set the MySQL datadir like this:

mysql_datadir: /data/mysql

When this is set the plays fail with this error on every database server:

fatal: [db05]: FAILED! => {"changed": false, "msg": "Unable to start service mysql: Job for mysql.service failed because the control process exited with error code.\nSee \"systemctl status mysql.service\" and \"journalctl -xeu mysql.service\" for details.\n"}

Then running sudo journalctl -xeu mysql turns up the following:

mysql-systemd-start[450456]: MySQL system database not found in /data/mysql. Please run mysqld --initialize

Unfortunately, running mysqld --initialize appears to work, but causes plays to fail at a later step with a MySQL permissions error. So it's not a viable workaround.

This issue is a duplicate of #399 , the bot closed it, despite it being a current issue.

OS: Ubuntu 22.04
MySQL version: /usr/sbin/mysqld Ver 8.0.31-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions