From 31cad9eda3a9d617bc8edb199ddd4656ba8133ab Mon Sep 17 00:00:00 2001 From: Christoffer Lindahl Date: Sat, 3 Sep 2022 22:23:57 +0200 Subject: [PATCH] Compatibility with MariaDB which uses "extra files" instead of "login paths". https://mariadb.com/kb/en/mysql_config_editor-compatibility/ --- automysqlbackup | 19 +++++++++++++------ automysqlbackup.conf | 4 ++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/automysqlbackup b/automysqlbackup index 8585c23..38f6323 100755 --- a/automysqlbackup +++ b/automysqlbackup @@ -84,7 +84,8 @@ load_default_config() { CONFIG_mysql_dump_dbstatus='yes' CONFIG_mysql_dump_differential='no' CONFIG_mysql_dump_login_path='automysqldump' - CONFIG_mysql_dump_login_path_file='' + CONFIG_mysql_dump_login_path_file='automysqldump' + CONFIG_mysql_dump_config_extra_file='' CONFIG_mysql_dump_encrypted_login='no' CONFIG_backup_local_files=() CONFIG_db_names=() @@ -113,11 +114,17 @@ mysql_commands() { VERSION=`mysql -V | grep -oE "[0-9]+\.[0-9]+\.[0-9]+"` NODOT_VER=`echo $VERSION | sed $OS_sed_option 's/\.//g'` if [ "${CONFIG_mysql_dump_encrypted_login}" = "yes" ]; then - export MYSQLDUMP="mysqldump --login-path=$CONFIG_mysql_dump_login_path" - export MYSQLSHOW="mysqlshow --login-path=$CONFIG_mysql_dump_login_path" - export MYSQL="mysql --login-path=$CONFIG_mysql_dump_login_path" - if [ -n "${CONFIG_mysql_dump_login_path_file}" ]; then - export MYSQL_TEST_LOGIN_FILE=$CONFIG_mysql_dump_login_path_file + if [ "${CONFIG_mysql_dump_config_extra_file}" != "" ]; then + export MYSQLDUMP="mysqldump --defaults-extra-file=$CONFIG_mysql_dump_config_extra_file" + export MYSQLSHOW="mysqlshow --defaults-extra-file=$CONFIG_mysql_dump_config_extra_file" + export MYSQL="mysql --defaults-extra-file=$CONFIG_mysql_dump_config_extra_file" + else + export MYSQLDUMP="mysqldump --login-path=$CONFIG_mysql_dump_login_path" + export MYSQLSHOW="mysqlshow --login-path=$CONFIG_mysql_dump_login_path" + export MYSQL="mysql --login-path=$CONFIG_mysql_dump_login_path" + if [ -n "${CONFIG_mysql_dump_login_path_file}" ]; then + export MYSQL_TEST_LOGIN_FILE=$CONFIG_mysql_dump_login_path_file + fi fi else export MYSQLDUMP="mysqldump --user=${CONFIG_mysql_dump_username} --password=${CONFIG_mysql_dump_password} --host=${CONFIG_mysql_dump_host}"; diff --git a/automysqlbackup.conf b/automysqlbackup.conf index 44c5e5e..d4fb50e 100644 --- a/automysqlbackup.conf +++ b/automysqlbackup.conf @@ -30,6 +30,10 @@ # The path to file where "login path" is stored #CONFIG_mysql_dump_login_path_file='' +# If connecting to a MariaDB server, use the following "extra file" instead of "login path" +# Read more at https://mariadb.com/kb/en/mysql_config_editor-compatibility/ +#CONFIG_mysql_dump_config_extra_file='automysqldump' + # Host name (or IP address) of MySQL server e.g localhost #CONFIG_mysql_dump_host='localhost'