Skip to content

Commit

Permalink
Update to 2.0.14
Browse files Browse the repository at this point in the history
PSQLADM-256

Issue
Using a password with a '%' character fails

Solution
We were escaping the '%' character, but this is unnecessary.
  • Loading branch information
kennt-percona committed Sep 22, 2020
1 parent 2352643 commit 8fc387c
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 24 deletions.
11 changes: 6 additions & 5 deletions proxysql-admin
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ fi
#
# Script parameters/constants
#
readonly PROXYSQL_ADMIN_VERSION="2.0.13"
readonly PROXYSQL_ADMIN_VERSION="2.0.14"
declare -i DEBUG=0

# default timeout is 10 seconds
Expand Down Expand Up @@ -428,6 +428,7 @@ function exec_sql() {
local retvalue
local retoutput
local default_auth=""
local defaults=""

if [[ $# -ge 7 ]]; then
args=$7
Expand All @@ -444,10 +445,10 @@ function exec_sql() {
fi

defaults=$(printf '[client]\nuser=%s\npassword="%s"\nhost=%s\nport=%s\nconnect-timeout=%s\n%s' \
"${user//%/%%}" \
"${password//%/%%}" \
"${hostname//%/%%}" \
"${port//%/%%}" \
"${user}" \
"${password}" \
"${hostname}" \
"${port}" \
"${TIMEOUT}" \
"${default_auth}"
)
Expand Down
4 changes: 2 additions & 2 deletions proxysql-admin.cnf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export CLUSTER_HOSTNAME='localhost'
export CLUSTER_PORT='3306'

# proxysql monitoring user. proxysql admin script will create this user in pxc to monitor pxc-nodes.
export MONITOR_USERNAME='monitor'
export MONITOR_PASSWORD='monitor'
export MONITOR_USERNAME='monitor2'
export MONITOR_PASSWORD='m%onitor'

# Application user to connect to pxc-node through proxysql
export CLUSTER_APP_USERNAME='proxysql_user'
Expand Down
43 changes: 26 additions & 17 deletions proxysql-status
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
#!/bin/bash -u

declare USER
declare PASSWORD
declare HOST
declare PORT
declare RUNTIME_OPTION=""
declare DUMP_ALL=1
declare DUMP_MAIN=0
declare DUMP_STATS=0
declare DUMP_MONITOR=0
declare DUMP_FILES=0
declare TABLE_FILTER=""
declare DUMP_STATS_RESET_TABLE=0


function usage() {
local path=$0
Expand Down Expand Up @@ -44,10 +57,20 @@ function mysql_exec() {
local query=$2
local retvalue
local retoutput
retoutput=$(printf "[client]\nuser=${USER}\npassword=\"${PASSWORD}\"\nhost=${HOST}\nport=${PORT}" \
| mysql --defaults-file=/dev/stdin --protocol=tcp \
${args} -e "${query}")
local defaults=""
local default_auth=""

defaults=$(printf '[client]\nuser=%s\npassword="%s"\nhost=%s\nport=%s\n%s' \
"${USER}" \
"${PASSWORD}" \
"${HOST}" \
"${PORT}" \
"${default_auth}"
)

retoutput=$(mysql --defaults-file=<(echo "${defaults}") --protocol=tcp --unbuffered --batch --silent ${args} -e "$query")
retvalue=$?

if [[ -n $retoutput ]]; then
retoutput+="\n"
fi
Expand All @@ -56,20 +79,6 @@ function mysql_exec() {
}


declare USER
declare PASSWORD
declare HOST
declare PORT
declare RUNTIME_OPTION=""
declare DUMP_ALL=1
declare DUMP_MAIN=0
declare DUMP_STATS=0
declare DUMP_MONITOR=0
declare DUMP_FILES=0
declare TABLE_FILTER=""
declare DUMP_STATS_RESET_TABLE=0


function parse_args() {
local go_out=""

Expand Down

0 comments on commit 8fc387c

Please sign in to comment.