Mariadb: Display error if user is not create

This PS updates the create-mysql-user.sh to display the error
if the exporter user was not created successfully.

Change-Id: I03505b5fb569cda199c2803086b77206b810ea3f
This commit is contained in:
Gupta, Sangeet (sg774j) 2019-03-25 11:56:05 -05:00 committed by Sangeet Gupta
parent 2f747ad6ba
commit 003f765e91

View File

@ -18,7 +18,10 @@ limitations under the License.
set -e
mysql --defaults-file=/etc/mysql/admin_user.cnf -e \
if ! mysql --defaults-file=/etc/mysql/admin_user.cnf -e \
"CREATE OR REPLACE USER '${EXPORTER_USER}'@'%' IDENTIFIED BY '${EXPORTER_PASSWORD}'; \
GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO '${EXPORTER_USER}'@'%'; \
FLUSH PRIVILEGES;"
FLUSH PRIVILEGES;" ; then
echo "ERROR: Could not create user: ${EXPORTER_USER}"
exit 1
fi