Project

General

Profile

Actions

Bug #200

open

MariaDB start script uses uninitialized array MYSQLD

Added by Igor Pashev about 5 years ago.

Status:
New
Priority:
Normal
Assignee:
-
Start date:
2019-11-15
Due date:
% Done:

0%

Estimated time:

Description

#!/bin/bash

set -euo pipefail

DEFAULTS_FILE=/etc/mysql/my.cnf

mysqld_get_param() {
        "${MYSQLD[@]}" --print-defaults \
                | tr " " "\n" \
                | grep -- "--$1" \
                | tail -n 1 \
                | cut -d= -f2 || echo "$2" 
}

DATADIR=$(mysqld_get_param 'datadir' '/var/lib/mysql')
SOCKET=$(mysqld_get_param 'socket' '/var/run/mysqld/mysqld.sock')
PID_FILE=$(mysqld_get_param 'pid-file' '/var/run/mysqld/mysqld.pid')

USER=$(mysqld_get_param 'user' 'mysql')
GROUP=$(id -n -g "$USER")

MYSQL=(/usr/bin/mysql --defaults-file="$DEFAULTS_FILE")

MYSQLD=(/usr/sbin/mysqld --defaults-file="$DEFAULTS_FILE")
MYSQLD+=(--datadir="$DATADIR")
MYSQLD+=(--pid-file="$PID_FILE")
MYSQLD+=(--socket="$SOCKET")
MYSQLD+=(--user="$USER")

...

No data to display

Actions

Also available in: Atom PDF