|
@@ -6,6 +6,11 @@ if [ ! -d /run/mysqld ]; then
|
6
|
6
|
fi
|
7
|
7
|
chown mysql:mysql /run/mysqld
|
8
|
8
|
|
|
9
|
+if [ /etc/my.cnf.d/mariadb-server.cnf ]; then
|
|
10
|
+ echo "Deleting dumb configuration file in newer mariadb alpine package"
|
|
11
|
+ rm /etc/my.cnf.d/mariadb-server.cnf
|
|
12
|
+fi
|
|
13
|
+
|
9
|
14
|
if [ ! -d $DATADIR ]; then
|
10
|
15
|
echo "initializing db because $DATADIR is missing"
|
11
|
16
|
|
|
@@ -38,4 +43,22 @@ if [ ! -d $DATADIR ]; then
|
38
|
43
|
fi
|
39
|
44
|
|
40
|
45
|
rm /tmp/dbinit.sql
|
|
46
|
+fi
|
|
47
|
+
|
|
48
|
+su-exec mysql:mysql mysqld --bind-address=127.0.0.1 --datadir=$DATADIR &
|
|
49
|
+pid="$!"
|
|
50
|
+
|
|
51
|
+for i in {30..0}; do
|
|
52
|
+ if echo 'SELECT 1' | mysql &> /dev/null; then
|
|
53
|
+ break
|
|
54
|
+ fi
|
|
55
|
+ echo 'MySQL init process in progress...'
|
|
56
|
+ sleep 5
|
|
57
|
+done
|
|
58
|
+
|
|
59
|
+mysql_upgrade
|
|
60
|
+
|
|
61
|
+if ! kill -s TERM "$pid" || ! wait "$pid"; then
|
|
62
|
+ echo >&2 'MySQL upgrade process failed.'
|
|
63
|
+ exit 1
|
41
|
64
|
fi
|