3
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
5
# This program is free software; you can redistribute it and/or modify
6
# it under the terms of the GNU General Public License as published by
7
# the Free Software Foundation; version 2 of the License.
9
# This program is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
# GNU General Public License for more details.
14
# You should have received a copy of the GNU General Public License
15
# along with this program; if not, write to the Free Software
16
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18
. /usr/share/debconf/confmodule
20
take_upstart_job_backup () {
21
if [ -e "/etc/init/mysql.conf" ] && [ -d "/var/lib/mysql" ];
23
mv /etc/init/mysql.conf /var/lib/mysql/.mysql.conf.backup
34
MYSQLDATA=/var/lib/mysql
36
if [ ! -d "${MYSQLDATA}/mysql" -a ! -L "${MYSQLDATA}/mysql" ];
38
mkdir ${MYSQLDATA}/mysql
39
chown mysql:mysql ${MYSQLDATA}/mysql
40
chmod 750 ${MYSQLDATA}/mysql
41
if [ ! "$(ls -A ${MYSQLDATA}/mysql)" ];
43
mysql_install_db --user=mysql > /dev/null
47
db_get mysql-community-server/root-pass && PASSWD=${RET}
48
if [ ! -z "${PASSWD}" ];
50
db_set mysql-community-server/root-pass ""
51
db_set mysql-community-server/re-root-pass ""
52
PASSWD="UPDATE user SET password=PASSWORD('${PASSWD}') WHERE user='root';"
64
DELETE FROM user WHERE user='';
67
mysqld --basedir=/usr --bootstrap --user=mysql --skip-grant-tables < $SQL
78
abort-upgrade|abort-remove|abort-configure)
89
take_upstart_job_backup