From 7715ba395c77fb7ade861b7cd0e708f9a5d22e7a Mon Sep 17 00:00:00 2001 From: Benedikt Koeppel Date: Sat, 18 Feb 2012 23:08:34 +0100 Subject: [PATCH] fixed mysql_server type can install now successfully removes test database and all grants sets a root password --- conf/type/__mysql_server/gencode-remote | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/conf/type/__mysql_server/gencode-remote b/conf/type/__mysql_server/gencode-remote index 07826d27..30803a91 100755 --- a/conf/type/__mysql_server/gencode-remote +++ b/conf/type/__mysql_server/gencode-remote @@ -23,34 +23,46 @@ rootpassword="$(cat "$__object/parameter/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 +cat <<-EOFF cat <<-EOF > /root/.my.cnf [client] password=$rootpassword EOF +EOFF # remove anonymous users -mysql -u root -p <<-EOF +cat <<-EOFF +mysql -u root <<-EOF DELETE FROM mysql.user WHERE User=''; EOF +EOFF # 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'; EOF +EOFF # remove test database -mysql -u root -p <<-EOF - DROP DATABASE test; +cat <<-EOFF +mysql -u root <<-EOF + DROP DATABASE IF EXISTS test; EOF -mysql -u root -p <<-EOF +EOFF +cat <<-EOFF +mysql -u root <<-EOF DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%' EOF +EOFF # flush privileges -mysql -u root -p <<-EOF +cat <<-EOFF +mysql -u root <<-EOF FLUSH PRIVILEGES; EOF +EOFF