jide / clamp

Command Line Apache MySQL PHP
http://jide.github.io/clamp
GNU General Public License v2.0
79 stars 9 forks source link

Clamp errors on start due to "unknown variable 'mysqlx-bind-address=127.0.0.1'" #50

Closed adambrgmn closed 3 months ago

adambrgmn commented 3 months ago

Hey! I'm just getting started with this tool as I started working on a project that already had it configured. I like the way it should be working. But I seem to be unable to get it working properly.

When I run clamp start it just fails with the following logs:

/usr/local/opt/mariadb/bin/mysql_install_db: Deprecated program name. It will be removed in a future release, use 'mariadb-install-db' instead
2024-06-10 15:29:38 0 [ERROR] /usr/local/opt/mariadb/bin/mariadbd: unknown variable 'mysqlx-bind-address=127.0.0.1'
2024-06-10 15:29:38 0 [ERROR] Aborting
cat: stdout: Broken pipe
cat: stdout: Broken pipe
cat: stdout: Broken pipe

This is from a clamp.json config that is practically the same as the output of clamp config write, with some minor adjustments that should not affect mariadb, just the apache server (I'll post the full config below).

Any idea what might be the issue?


Here's my system info: OS: MacOS Monterey 12.7.5 mariadb: mariadb from 11.4.2-MariaDB, client 15.2 for osx10.17 (x86_64) using EditLine wrapper

clamp.json:

{
  "address": "localhost",
  "memory": "1024M",
  "database": "project_name",
  "host": {
    "options": {
      "127.0.0.1": "{{$.address}}"
    }
  },
  "apache": {
    "commands": {
      "httpd": "$(brew --prefix)/bin/httpd"
    },
    "options": {
      "<Directory": " '{{$cwd}}'>",
      "AllowOverride": "All",
      "</Directory>": "",
      "servername": "{{$.address}}",
      "listen": "80",
      "documentroot": "'{{$cwd}}/app'",
      "serverroot": "'{{$cwd}}'",
      "pidfile": "'{{$cwd}}/.clamp/tmp/httpd.pid'",
      "defaultruntimedir": "'{{$cwd}}/.clamp/tmp",
      "loglevel": "info",
      "errorlog": "'{{$cwd}}/.clamp/logs/apache.error.log'",
      "customlog": "'{{$cwd}}/.clamp/logs/apache.access.log' common",
      "addtype": "application/x-httpd-php .php",
      "directoryindex": "index.php index.html",
      "setenv": "LOCAL_SERVER true",
      "user": "`whoami`",
      "autoopen": false,
      "group": "_www",
      "\" -C \"loadmodule mpm_prefork_module": "$(brew --prefix)/lib/httpd/modules/mod_mpm_prefork.so",
      "loadmodule": {
        "log_config_module": "$(brew --prefix)/lib/httpd/modules/mod_log_config.so",
        "mime_module": "$(brew --prefix)/lib/httpd/modules/mod_mime.so",
        "dir_module": "$(brew --prefix)/lib/httpd/modules/mod_dir.so",
        "authz_core_module": "$(brew --prefix)/lib/httpd/modules/mod_authz_core.so",
        "authz_host_module": "$(brew --prefix)/lib/httpd/modules/mod_authz_host.so",
        "env_module": "$(brew --prefix)/lib/httpd/modules/mod_env.so",
        "rewrite_module": "$(brew --prefix)/lib/httpd/modules/mod_rewrite.so",
        "unixd_module": "$(brew --prefix)/lib/httpd/modules/mod_unixd.so",
        "php_module": "$(brew --prefix)/opt/php/lib/httpd/modules/libphp.so"
      },
      "php_admin_value": "{{$.php.options}}"
    }
  },
  "mysql": {
    "commands": {
      "mysql": "$(brew --prefix mariadb)/bin/mariadb",
      "mysqld": "$(brew --prefix mariadb)/bin/mariadbd",
      "mysqladmin": "$(brew --prefix mariadb)/bin/mariadb-admin",
      "mysqldump": "$(brew --prefix mariadb)/bin/mariadb-dump",
      "mysql_install_db": "$(brew --prefix mariadb)/bin/mysql_install_db --auth-root-authentication-method=normal"
    },
    "databases": ["{{$.database}}"],
    "options": {
      "bind-address": "127.0.0.1",
      "port": "3306",
      "lower_case_table_names": 2,
      "basedir": "$(brew --prefix mariadb)",
      "datadir": "'{{$cwd}}/.clamp/data'",
      "socket": "'{{$cwd}}/.clamp/tmp/mysql.sock'",
      "pid-file": "'{{$cwd}}/.clamp/tmp/mysql.pid'",
      "log_error": "'{{$cwd}}/.clamp/logs/mysql.error.log'",
      "max_binlog_size": "10M",
      "max_allowed_packet": "32M"
    }
  },
  "php": {
    "options": {
      "pdo_mysql.default_socket": "{{$.mysql.options.socket}}",
      "mysql.default_socket": "{{$.mysql.options.socket}}",
      "mysqli.default_socket": "{{$.mysql.options.socket}}"
    }
  }
}
adambrgmn commented 3 months ago

So after some more tiresome digging it seems that I found the issue! And it has nothing to do with clamp. Sorry if I scared you 🥸

For future reference, if someone ends up at this issue with a similar problem:

This was an issue related to the global configuration of mariadb. When you install mariadb with Homebrew it will create a global configuration file for you somewhere in your filesystem, for me it was /usr/local/etc/my.cnf (you can get the location by running $(brew --prefix mariadb)/bin/mariadbd --verbose --help | grep -A 1 "Default options"):

# Default Homebrew MySQL server config
[mysqld]
# Only allow connections from localhost
bind-address = 127.0.0.1
mysqlx-bind-address = 127.0.0.1

That last line was my culprit, and looking at the formulae it was not added by Homebrew. I have no idea where it came from. So somehow that line was added to my configuration. But after removing it everything worked as expected.

Thanks for a great project 👍