forked from ungleich-public/cdist
fixed mysql_server type
can install now successfully removes test database and all grants sets a root password
This commit is contained in:
parent
3a810fa5ea
commit
7715ba395c
1 changed files with 19 additions and 7 deletions
|
@ -23,34 +23,46 @@
|
||||||
rootpassword="$(cat "$__object/parameter/password")"
|
rootpassword="$(cat "$__object/parameter/password")"
|
||||||
|
|
||||||
# set root password
|
# set root password
|
||||||
mysqladmin -u root password $rootpassword
|
echo "mysqladmin -u root password $rootpassword"
|
||||||
|
|
||||||
# store the root password in /root/.my.cnf so that processes can connect
|
# store the root password in /root/.my.cnf so that processes can connect
|
||||||
|
cat <<-EOFF
|
||||||
cat <<-EOF > /root/.my.cnf
|
cat <<-EOF > /root/.my.cnf
|
||||||
[client]
|
[client]
|
||||||
password=$rootpassword
|
password=$rootpassword
|
||||||
EOF
|
EOF
|
||||||
|
EOFF
|
||||||
|
|
||||||
# remove anonymous users
|
# remove anonymous users
|
||||||
mysql -u root -p <<-EOF
|
cat <<-EOFF
|
||||||
|
mysql -u root <<-EOF
|
||||||
DELETE FROM mysql.user WHERE User='';
|
DELETE FROM mysql.user WHERE User='';
|
||||||
EOF
|
EOF
|
||||||
|
EOFF
|
||||||
|
|
||||||
# remove remote-access for root
|
# remove remote-access for root
|
||||||
mysql -u root -p <<-EOF
|
cat <<-EOFF
|
||||||
|
mysql -u root <<-EOF
|
||||||
DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';
|
DELETE FROM mysql.user WHERE User='root' AND Host!='localhost';
|
||||||
EOF
|
EOF
|
||||||
|
EOFF
|
||||||
|
|
||||||
# remove test database
|
# remove test database
|
||||||
mysql -u root -p <<-EOF
|
cat <<-EOFF
|
||||||
DROP DATABASE test;
|
mysql -u root <<-EOF
|
||||||
|
DROP DATABASE IF EXISTS test;
|
||||||
EOF
|
EOF
|
||||||
mysql -u root -p <<-EOF
|
EOFF
|
||||||
|
cat <<-EOFF
|
||||||
|
mysql -u root <<-EOF
|
||||||
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'
|
DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%'
|
||||||
EOF
|
EOF
|
||||||
|
EOFF
|
||||||
|
|
||||||
# flush privileges
|
# flush privileges
|
||||||
mysql -u root -p <<-EOF
|
cat <<-EOFF
|
||||||
|
mysql -u root <<-EOF
|
||||||
FLUSH PRIVILEGES;
|
FLUSH PRIVILEGES;
|
||||||
EOF
|
EOF
|
||||||
|
EOFF
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue