Skip to content

How to install MySQL instead of MariaDB on Ubuntu 22.04? #1582

Open
@tetsuo13

Description

@tetsuo13

Describe the Bug

Beginning with v13.0.0 of this module, the default behavior on Ubuntu versions 20.04 and greater is to install MariaDB. As of this writing, the README doesn't mention this behavior nor how to install MySQL instead. I tried using the package_name parameter of "mysql-server" however that appears to have mixed results and ultimately failing to install MySQL as expected.

This behavior appears to be first documented in #1449 (comment) with no workarounds.

Expected Behavior

With one or more parameters set, MySQL should be installed.

Steps to Reproduce

As an example, using the following

class { 'mysql::server':
    package_name => 'mysql-server',
}

on a fresh install of Ubuntu 22.04, this is the output:

Notice: Compiled catalog for server in environment production in 0.87 seconds
Notice: /Stage[main]/Mysql::Server::Config/File[/etc/mysql]/ensure: created
Notice: /Stage[main]/Mysql::Server::Config/File[/etc/mysql/conf.d]/ensure: created
Notice: /Stage[main]/Mysql::Server::Config/Exec[datadir-managed_dir-mkdir]/returns: executed successfully
Notice: /Stage[main]/Mysql::Server::Config/Exec[datadir-managed_dir-chmod]: Triggered 'refresh' from 1 event
Notice: /Stage[main]/Mysql::Server::Config/File[mysql-config-file]/ensure: defined content as '{sha256}39c740fb553b58d69cd7c18415cfc346d834cd4c6429a024ac39332a1832e5e5'
Notice: /Stage[main]/Mysql::Server::Install/Package[mysql-server]/ensure: created
Error: Systemd start for mariadb failed!
journalctl log for mariadb:
-- No entries --

Error: /Stage[main]/Mysql::Server::Service/Service[mysqld]/ensure: change from 'stopped' to 'running' failed: Systemd start for mariadb failed!
journalctl log for mariadb:
-- No entries --

Notice: /Stage[main]/Mysql::Server::Service/Exec[wait_for_mysql_socket_to_open]: Dependency Service[mysqld] has failures: true
Warning: /Stage[main]/Mysql::Server::Service/Exec[wait_for_mysql_socket_to_open]: Skipping because of failed dependencies
Warning: /Stage[main]/Mysql::Server::Root_password/Exec[remove install pass]: Skipping because of failed dependencies
Warning: /Stage[main]/Mysql::Server::Root_password/Mysql_user[root@localhost]: Skipping because of failed dependencies
Warning: /Stage[main]/Mysql::Server::Root_password/File[/root/.my.cnf]: Skipping because of failed dependencies
Warning: /Stage[main]/Mysql::Server/Anchor[mysql::server::end]: Skipping because of failed dependencies
Notice: /Stage[main]/Mysql::Client::Install/Package[mysql_client]/ensure: created
Error: Could not prefetch mysql_database provider 'mysql': Execution of '/usr/bin/mysql -NBe show databases' returned 1: ERROR 2002 (HY000): Can't connect to local server through socket '/var/run/mysqld/mysqld.sock' (2)
Notice: Applied catalog in 66.53 seconds

Environment

  • v14.0.0
  • Ubuntu 22.04

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions