/usr/bin/dpsyco-mysql-dbuser is in dpsyco-mysql 1.0.36.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | #!/bin/sh
# DocumentId: $Id: dpsyco-mysql-dbuser 2318 2006-07-19 17:58:05Z ola $
# Author: $Author: ola $
# Ola Lundqvist <opal@debian.org>
# Arguments: username host password
# Summary:
# Helps to create a user for the mysql-database.
#
# Copyright (C) 2001-2004 Ola Lundqvist <opal@debian.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
#
dbserver=localhost
. /usr/share/wwwconfig-common/mysql-localadmpass.get
dbuser=$1
dballow=$2
dbpass=$3
status=error
. /usr/share/wwwconfig-common/mysql.get
if [ -z "$dbpass" ] ; then
echo "Warning, no password for user $dbuser."
fi
if [ -z "$dbuser" ] ; then
echo "No database user specified. Can not create it if it does not exist."
elif [ -z "$dbserver" ] ; then
echo "No database server specified."
elif [ -z "$dbadmin" ] ; then
echo "No database administrator specified."
elif [ -z "$dbadmpass" ] ; then
echo "No database ($dbadmin) administrator password specified."
elif [ ! -x $(which mysql) ] ; then
echo "No mysql client to execute."
elif ! $mysqlcmd -f mysql -e "show tables;" >/dev/null 2>&1 ; then
echo "Error when trying to connect to the mysql database."
echo "This error can occur if you have no database to connect to, or"
echo "if the password was incorrect."
echo "use: dpkg-reconfigure -plow packagename to reconfigure."
else
echo "Creating or resetting database user ($dbuser) on $dballow."
if $mysqlcmd -f mysql -e "
CONNECT mysql;
REPLACE INTO user ( host, user, password )
VALUES (
'$dballow',
'$dbuser',
password( '$dbpass' )
);
flush privileges;
" > /dev/null 2>&1 ; then
if ! $mysqlcmd -f mysql -e "select User from user;" | grep $dbuser >/dev/null 2>&1 ; then
echo "Database user $dbuser NOT successfully added. You have to do it manually."
fi
else
echo "Unable to run the create user script."
fi
fi
|