|
| 1 | +#!/usr/bin/with-contenv bash |
| 2 | +# shellcheck shell=bash |
| 3 | + |
| 4 | +# check logrotate permissions |
| 5 | +if mariadb-admin -uroot --local version >/dev/null 2>&1; then |
| 6 | + echo "Logrotate is enabled" |
| 7 | +else |
| 8 | + cat <<-EOFPASS |
| 9 | + |
| 10 | + |
| 11 | + |
| 12 | +##################################################################################### |
| 13 | +# # |
| 14 | +# Logrotate Instructions # |
| 15 | +# # |
| 16 | +# Add the following to /config/custom.cnf under [mysqld]: # |
| 17 | +# log_error = /config/log/mysql/mariadb-error.log # |
| 18 | +# # |
| 19 | +# Login to the SQL shell inside the container using: # |
| 20 | +# mariadb -uroot -p<PASSWORD> # |
| 21 | +# And run the following command: # |
| 22 | +# GRANT ALL ON *.* TO root@localhost IDENTIFIED VIA unix_socket WITH GRANT OPTION ; # |
| 23 | +# # |
| 24 | +# Restart the container to apply the changes. # |
| 25 | +# # |
| 26 | +# You can read more about root@localhost permissions here: # |
| 27 | +# https://mariadb.com/kb/en/authentication-from-mariadb-10-4/ # |
| 28 | +# # |
| 29 | +##################################################################################### |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +EOFPASS |
| 34 | +fi |
| 35 | + |
| 36 | +# check for upgrades |
| 37 | +if [[ "${#MYSQL_ROOT_PASSWORD}" -gt "3" ]]; then |
| 38 | + # display a message about upgrading database if needed |
| 39 | + if mariadb-upgrade -u root -p"${MYSQL_ROOT_PASSWORD}" --check-if-upgrade-is-needed >/dev/null 2>&1; then |
| 40 | + cat <<-EOF |
| 41 | + |
| 42 | + |
| 43 | + |
| 44 | +################################################################# |
| 45 | +# # |
| 46 | +# An upgrade is required on your databases. # |
| 47 | +# # |
| 48 | +# Stop any services that are accessing databases # |
| 49 | +# in this container, and then run the command # |
| 50 | +# # |
| 51 | +# mariadb-upgrade -u root # |
| 52 | +# # |
| 53 | +################################################################# |
| 54 | + |
| 55 | + |
| 56 | + |
| 57 | +EOF |
| 58 | + sleep 5s |
| 59 | + fi |
| 60 | +fi |
0 commit comments