Skip to content

Commit 588f406

Browse files
author
Dean Troyer
committed
Change MySQL engine default to InnoDB
Fixes bug 971881 13Apr2012 - rebased to add Fedora support Change-Id: Ib93187b4727157cc8dc63cd4599970535c85adce
1 parent d4c420d commit 588f406

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

stack.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -797,15 +797,28 @@ EOF
797797
# Update the DB to give user ‘$MYSQL_USER’@’%’ full control of the all databases:
798798
sudo mysql -uroot -p$MYSQL_PASSWORD -h127.0.0.1 -e "GRANT ALL PRIVILEGES ON *.* TO '$MYSQL_USER'@'%' identified by '$MYSQL_PASSWORD';"
799799

800-
# Edit /etc/mysql/my.cnf to change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0) and restart the mysql service:
800+
# Update ``my.cnf`` for some local needs and restart the mysql service
801801
if [[ "$os_PACKAGE" = "deb" ]]; then
802-
MY_CNF=/etc/mysql/my.cnf
802+
MY_CONF=/etc/mysql/my.cnf
803803
MYSQL=mysql
804804
else
805-
MY_CNF=/etc/my.cnf
805+
MY_CONF=/etc/my.cnf
806806
MYSQL=mysqld
807807
fi
808-
sudo sed -i 's/127.0.0.1/0.0.0.0/g' $MY_CNF
808+
809+
# Change ‘bind-address’ from localhost (127.0.0.1) to any (0.0.0.0)
810+
sudo sed -i '/^bind-address/s/127.0.0.1/0.0.0.0/g' $MY_CONF
811+
812+
# Set default db type to InnoDB
813+
if grep -q "default-storage-engine" $MY_CONF; then
814+
# Change it
815+
sudo bash -c "source $TOP_DIR/functions; iniset $MY_CONF mysqld default-storage-engine InnoDB"
816+
else
817+
# Add it
818+
sudo sed -i -e "/^\[mysqld\]/ a \
819+
default-storage-engine = InnoDB" $MY_CONF
820+
fi
821+
809822
restart_service $MYSQL
810823
fi
811824

0 commit comments

Comments
 (0)