Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
tetsuo13 opened this issue Jul 8, 2023 · 4 comments
Open

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

tetsuo13 opened this issue Jul 8, 2023 · 4 comments

Comments

@tetsuo13
Copy link

tetsuo13 commented Jul 8, 2023

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

@daehnomel
Copy link

I orginally reported this and have been getting nothing but the runaround from this team. At this point the module should be renamed the puppetlabs-mariaDB module.

@hboetes
Copy link

hboetes commented Aug 4, 2023

I just tried a later version and indeed, it feels like they want to force MariaDB down our throat!

@androidSalander
Copy link

I am having the same problem. after unsuccessfully trying a few different configurations like package_name above, I attempted to look through the module's files to see if there was some default mariaDB install commands that I could edit or remove, but I didn't even find one reference to mariaDB outside of a mysql_datadir file that isn't even related to Ubuntu. what gives? seems like I have no choice but to remove this module.

@andrewbierbaum
Copy link

andrewbierbaum commented Dec 15, 2023

The relevant configuration is https://github.com/puppetlabs/puppetlabs-mysql/blob/main/manifests/params.pp#L154-L173

    'Debian': {
      if $facts['os']['name'] == 'Debian' or $facts['os']['name'] == 'Raspbian' or
      ($facts['os']['name'] == 'Ubuntu' and versioncmp($facts['os']['release']['major'], '20.04') >= 0) {
        $provider = 'mariadb'
      } else {
        $provider = 'mysql'
      }
      if $provider == 'mariadb' {
        $client_package_name     = 'mariadb-client'
        $server_package_name     = 'mariadb-server'
        $server_service_name     = 'mariadb'
        $client_dev_package_name = 'libmariadbclient-dev'
        $daemon_dev_package_name = 'libmariadbd-dev'
      } else {
        $client_package_name     = 'mysql-client'
        $server_package_name     = 'mysql-server'
        $server_service_name     = 'mysql'
        $client_dev_package_name = 'libmysqlclient-dev'
        $daemon_dev_package_name = 'libmysqld-dev'
      }

I was able to override the MariaDB configuration back to mysql using the following

mysql::server::package_name: 'mysql-server'
mysql::client::package_name: 'mysql-client'
mysql::server::service_name: 'mysql'
mysql::bindings::client_dev_package_name: 'libmysqlclient-dev'
mysql::bindings::daemon_dev_package_name: 'libmysqld-dev'

However, this should just be fixed upstream in a better way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants