Add configuration file for script 'optimize_mysql_tables.sh'.

This commit is contained in:
root 2017-07-03 16:11:45 +02:00
parent 639adf672c
commit 37d7ada44c
3 changed files with 50 additions and 25 deletions

1
.gitignore vendored
View File

@ -1,2 +1,3 @@
/conf/*.conf
/BAK/*
databases.txt*

View File

@ -0,0 +1,34 @@
# ----------------------------------------------------
# ---
# - Parameter Settings for Script 'optimize_mysql_tables.sh'
# ---
# ----------------------------------------------------
# - MySQL / MariaDB credentials
# -
# - Giving password on command line is insecure an sind mysql 5.5
# - you will get a warning doing so.
# -
# - Reading username/password fro file ist also possible, using MySQL/MariaDB
# - commandline parameter '--defaults-file'.
# -
# - Since Version 5.6, that method is considered as insecure.
# - To avoid giving the password on command line, we use an
# - encrypted option file
# -
# - Create (encrypted) option file:
# - $ mysql_config_editor set --login-path=local --socket=/var/run/mysqld/mysqld.sock --user=backup --password
# - $ Password:
# -
# - Use of option file:
# - $ mysql --login-path=local ...
# -
# - Example
# - mysql_credential_args="--login-path=local"
# - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
# - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
# -
# - Defaults to mysql_credential_args="--login-path=local"
# -
mysql_credential_args=""

View File

@ -1,5 +1,8 @@
#!/usr/bin/env bash
working_dir="$(dirname $(realpath $0))"
conf_file="${working_dir}/conf/optimize_mysql_tables.conf"
# - Is this script running on terminal ?
# -
if [[ -t 1 ]] ; then
@ -18,31 +21,18 @@ if [ -z "$mysql" ]; then
fi
fi
# - MySQL / MariaDB credentials
# -
# - Giving password on command line is insecure an sind mysql 5.5
# - you will get a warning doing so.
# -
# - Reading username/password fro file ist also possible, using MySQL/MariaDB
# - commandline parameter '--defaults-file'.
# -
# - Since Version 5.6, that method is considered as insecure.
# - To avoid giving the password on command line, we use an
# - encrypted option file
# -
# - Create (encrypted) option file:
# - $ mysql_config_editor set --login-path=local --socket=/tmp/mysql.sock --user=root --password
# - $ Password:
# -
# - Use of option file:
# - $ mysql --login-path=local ...
# -
# - Example
# - mysql_credential_args="--login-path=local"
# - mysql_credential_args="--defaults-file=/etc/mysql/debian.cnf" (Debian default)
# - mysql_credential_args="--defaults-file=/usr/local/mysql/sys-maint.cnf"
# -
mysql_credential_args="--login-path=local"
#---------------------------------------
#-----------------------------
# Read Configurations from $conf_file
#-----------------------------
#---------------------------------------
if [[ -f "$conf_file" ]]; then
source "$conf_file"
fi
[[ -z "$mysql_credential_args" ]] && mysql_credential_args="--login-path=local"
if [ -n "$mysql_credential_args" ] ; then