kolla-ansible/docker/mariadb/security_reset.expect
Steven Dake 09e9b1be33 Move the mariadb expect code to a script
Atleast in a script, sudo can be made to only allow the script to
run from the mysql process in the future, versus all the proceesses
being able to be executed as root presently.

Change-Id: I030b57086e37e4dc8f668f98c04335d94ab9d2b0
Partially-Implements: blueprint drop-root
2015-11-11 18:42:07 -05:00

22 lines
509 B
Plaintext

#!/usr/bin/expect -f
set timeout 10
spawn mysql_secure_installation
expect "Enter current password for root (enter for none):"
send "\r"
expect "Set root password?"
send "y\r"
expect "New password:"
send "$env(DB_ROOT_PASSWORD)\r"
expect "Re-enter new password:"
send "$env(DB_ROOT_PASSWORD)\r"
expect "Remove anonymous users?"
send "y\r"
expect "Disallow root login remotely?"
send "n\r"
expect "Remove test database and access to it?"
send "y\r"
expect "Reload privilege tables now?"
send "y\r"
expect eof