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

latest tag 1:11.0.2+maria~ubu2204 - mysql command is gone #512

Closed
stanthewizzard opened this issue Jun 10, 2023 · 18 comments
Closed

latest tag 1:11.0.2+maria~ubu2204 - mysql command is gone #512

stanthewizzard opened this issue Jun 10, 2023 · 18 comments

Comments

@stanthewizzard
Copy link

Hello

mysql command is not working in latest iteration of mariadb.
Is this on purpose ?

Thanks

@thaJeztah
Copy link

Looks on purpose; see the release notes for 11.0; https://mariadb.com/kb/en/mariadb-11-0-1-release-notes/#docker-official-images

@iamromandev
Copy link

Yes its surprising though. I have been forced to use previous version.

@stanthewizzard
Copy link
Author

So I need to rewrite a lot of things. But whyyy ? Lol
Thanks

@thaJeztah
Copy link

Don't know the details, but I see there's links to some tickets (my hunch would be that they may no longer be fully compatible with the mysql command line in future);

Last one mentions;

There's too many old and new people referring to MariaDB as MySQL. We need to encourage the transition in naming.
Because mariadb names have began in 10.4, lets step up the conversion process by adding a deprecation notice on mysql names.

⚠️ Note that 11.0 is a non-LTS release (and release notes call out to not use those in production); 10.0 is an LTS release (supported until 2028), so if you need stability, it may be preferable to use an LTS release.

@iangilfillan
Copy link
Contributor

warning Note that 11.0 is a non-LTS release (and release notes call out to not use those in production); 10.0 is an LTS release (supported until 2028), so if you need stability, it may be preferable to use an LTS release.

To clarify, 10.0 is long EOL. The latest LTS release is 10.11: https://mariadb.org/about/#maintenance-policy

@thaJeztah
Copy link

Ah, you're right; thanks for correcting; I'm not too familiar with the versioning scheme used ☺️

@grooverdan
Copy link
Member

For everyone using mysqladmin (or mariadb-admin) ping as a healthcheck, this is a flawed implementation. This is because the mariadb-install-db script, /docker-entrypoint-initdb.d scripts and the MARIADB_AUTO_UPGRADE=1 will start the mariadbd in a --skip-networking form to which the ping will return true (unix socket connection is the default) before shutting down after completion of that stage to auto-start again without --skip-networking.

The workaround is:

env:
      MARIADB_MYSQL_LOCALHOST_USER: 1
      MARIADB_MYSQL_LOCALHOST_GRANTS: USAGE
options: --health-cmd="healthcheck.sh --su-mysql --connect --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3

This unfortunately is a little noisy without an empty root password. I started to work on a solution #508 but stalled. I'm considering a random root password for root@::1 / root@127.0.0.1 with it stored in a file passed in the healthcheck.sh --connect. Thoughts welcome.

@grooverdan
Copy link
Member

wrote https://mariadb.com/kb/en/using-healthcheck-sh-script/ finally

and https://mariadb.org/mariadb-server-docker-official-images-healthcheck-without-mysqladmin/

@thaJeztah
Copy link

@grooverdan (haven't looked closely as my comments were basically just a drive-by 🙈) were you planning to update your #508 PR to update https://github.com/MariaDB/mariadb-docker/blob/master/healthcheck.sh ?

@grooverdan
Copy link
Member

@grooverdan (haven't looked closely as my comments were basically just a drive-by see_no_evil)

That managed to find the release notes and the server JIRA entries 😄 .

were you planning to update your #508 PR to update https://github.com/MariaDB/mariadb-docker/blob/master/healthcheck.sh ?

Updated now. drive-by reviews welcome too 😸 .

mrdrogdrog added a commit to hedgedoc/hedgedoc that referenced this issue Jun 19, 2023
According to MariaDB/mariadb-docker#512 (comment)
the mysqladmin command has been removed from the image.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
mrdrogdrog added a commit to hedgedoc/hedgedoc that referenced this issue Jun 19, 2023
According to MariaDB/mariadb-docker#512 (comment)
the mysqladmin command has been removed from the image.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
mrdrogdrog added a commit to hedgedoc/hedgedoc that referenced this issue Jun 19, 2023
According to MariaDB/mariadb-docker#512 (comment)
the mysqladmin command has been removed from the image.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
mrdrogdrog added a commit to hedgedoc/hedgedoc that referenced this issue Jun 19, 2023
According to MariaDB/mariadb-docker#512 (comment)
the mysqladmin command has been removed from the image.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
mrdrogdrog added a commit to hedgedoc/hedgedoc that referenced this issue Jun 19, 2023
According to MariaDB/mariadb-docker#512 (comment)
the mysqladmin command has been removed from the image.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
mrdrogdrog added a commit to hedgedoc/hedgedoc that referenced this issue Jun 19, 2023
According to MariaDB/mariadb-docker#512 (comment)
the mysqladmin command has been removed from the image.

Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
bpatrik added a commit to bpatrik/pigallery2 that referenced this issue Jun 21, 2023
Locking mariaDB version to LTS. See MariaDB/mariadb-docker#512
@grooverdan
Copy link
Member

So healthcheck updates from #508 have been released. There is now a healthcheck@{localhost,127.0.0.1,::1} user created always with a random password, USAGE privs, and put into the /var/lib/mysql/.my-healthcheck.cnf file. If you need more MARIADB_HEALTHCHECK_GRANTS=REPLICA MONITOR for example can be set for replication based healthchecks.

As such you'll need just the following for a healthcheck without being dependent on any environment variables

options: --health-cmd="healthcheck.sh --innodb_initialized" --health-interval=10s --health-timeout=5s --health-retries=3

Even the --innodb_initialized occurs over TCP so doubles the same as ---connect.

I haven't see a major case for re-adding mysql commands, we where going to do it eventually, maybe a depreciation would have been nicer, but it seems to be done and the major use case of healthchecks has been improved.

Sorry for the interruption and I hope you're happy with the improved healthcheck.

@gremo
Copy link

gremo commented Jun 27, 2023

Thank you @grooverdan this was really needed! For Docker users, now you can do the following:

version: '3.8'

services:
    db:
        image: mariadb:10.6
        volumes:
            - db_data:/var/lib/mysql
        environment:
            MARIADB_ROOT_PASSWORD: foo
        ports:
            - '3306:3306'
        healthcheck:
            test: ['CMD', '/usr/local/bin/healthcheck.sh', '--innodb_initialized']
            start_period: 5s
            timeout: 5s
            interval: 5s
            retries: 5

volumes:
    db_data:

@stanthewizzard
Copy link
Author

@gremo tried it but access denied for root.

@grooverdan
Copy link
Member

@stanthewizzard the new healthcheck user is only added for fresh installs of the data.

@stanthewizzard
Copy link
Author

stanthewizzard commented Jun 28, 2023

ok I have to add it manually. With a password ?
or something else ?
thanks

@grooverdan
Copy link
Member

You can, like the script, create user ..., grant usage ... and create .my-healthcheck.cnf in /var/lib/mysql.

@stanthewizzard
Copy link
Author

cool I'll do that

@stanthewizzard
Copy link
Author

stanthewizzard commented Jun 28, 2023

just to help other

create user in DB:

CREATE USER healthcheck@'127.0.0.1' IDENTIFIED BY '$healthCheckConnectPassEscaped';
CREATE USER healthcheck@'::1' IDENTIFIED BY '$healthCheckConnectPassEscaped';
CREATE USER healthcheck@localhost IDENTIFIED BY '$healthCheckConnectPassEscaped';

then (as there is a jonction for DB in docker compose and for ex:

volumes:
      - ./db:/var/lib/mysql

vi
.my-healthcheck.cnf

[mariadb-client]
user=healthcheck
protocol=tcp

protocol=tcp needed to enforce what used to be a --connect test.

then
docker exec -it watehvermariadb /bin/bash
./usr/local/bin/healthcheck.sh --innodb_initialized

NO ERROR
than possible to use in docker compose

        healthcheck:
            test: ['CMD', '/usr/local/bin/healthcheck.sh', '--innodb_initialized']
            start_period: 5s
            timeout: 5s
            interval: 5s
            retries: 5

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

No branches or pull requests

6 participants