diff options
author | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2015-02-24 16:46:45 -0500 |
---|---|---|
committer | Jerome Charaoui <jcharaoui@cmaisonneuve.qc.ca> | 2015-02-24 16:46:45 -0500 |
commit | a713d36aeb35595792c09222e4424abfa07ddad8 (patch) | |
tree | 0ccda588dd9d74dc36529347b19d4ee99a5e72b7 /files/scripts/Debian | |
parent | 9b327191c775b8d73bfc1f8e5da062703cf7f377 (diff) | |
parent | 0ce33a632f30f8845359e2fc146789013dcd4984 (diff) |
Merge branch 'master' of git://git.puppet.immerda.ch/module-mysql
Conflicts:
files/scripts/optimize_tables.rb
manifests/server/base.pp
Diffstat (limited to 'files/scripts/Debian')
-rw-r--r-- | files/scripts/Debian/setmysqlpass.sh | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/files/scripts/Debian/setmysqlpass.sh b/files/scripts/Debian/setmysqlpass.sh index f4ebee6..3de2781 100644 --- a/files/scripts/Debian/setmysqlpass.sh +++ b/files/scripts/Debian/setmysqlpass.sh @@ -25,12 +25,15 @@ must_have chown rootpw=$(grep password /root/.my.cnf | sed -e 's/^[^=]*= *\(.*\) */\1/') +/usr/bin/mysqladmin -uroot --password="${rootpw}" status > /dev/null && echo "Nothing to do as the password already works" && exit 0 + /etc/init.d/mysql stop /usr/sbin/mysqld --skip-grant-tables --user=root --datadir=/var/lib/mysql --log-bin=/var/lib/mysql/mysql-bin & sleep 5 mysql -u root mysql <<EOF UPDATE mysql.user SET Password=PASSWORD('$rootpw') WHERE User='root' AND Host='localhost'; +DELETE FROM mysql.user WHERE (User='root' AND Host!='localhost') OR USER=''; FLUSH PRIVILEGES; EOF killall mysqld @@ -38,6 +41,7 @@ sleep 15 # chown to be on the safe side ls -al /var/lib/mysql/mysql-bin.* &> /dev/null [ $? == 0 ] && chown mysql.mysql /var/lib/mysql/mysql-bin.* +chown -R mysql.mysql /var/lib/mysql/data/ /etc/init.d/mysql start |