summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Black <daniel@mariadb.org>2021-06-03 15:48:38 +1000
committerAnel Husakovic <anel@mariadb.org>2021-07-06 11:08:57 +0200
commit8ab58d7b82f2cb2dfd4d530517428444ae041949 (patch)
tree6f5ef9311747ba410fd1242fd484b670783ade3d
parentb5862ce74a7348b7f213c1a47b4eaececf5a82e5 (diff)
downloadmariadb-git-8ab58d7b82f2cb2dfd4d530517428444ae041949.tar.gz
MDEV-19316: mysql_secure_installation should offer to rename root user
Based off @ManjotS's implementation in #1288
-rw-r--r--scripts/mysql_secure_installation.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/scripts/mysql_secure_installation.sh b/scripts/mysql_secure_installation.sh
index 8aadd018c13..644c9fbc6e8 100644
--- a/scripts/mysql_secure_installation.sh
+++ b/scripts/mysql_secure_installation.sh
@@ -478,6 +478,21 @@ echo
get_user_and_password
+if [ $user = root ] && [ $unix_socket_auth -ne 1 ]; then
+ echo "Changing the root username obfuscates administrative users and"
+ echo "helps prevent targeted attacks."
+ echo
+ echo "If you change the root username you must provide a password for"
+ echo "the user."
+ echo
+ echo $echo_n "Change root username to what username? (blank for no change) $echo_c"
+ read reply
+ if [ -n "$reply" ]; then
+ user=$reply
+ do_query "EXECUTE IMMEDIATE CONCAT('RENAME USER ', CURRENT_USER(), ' TO $user')"
+ make_config
+ fi
+fi
#
# Set unix_socket auth (if not already)