Homepage | Products | OX Knowledge Base | Support | Try Now | Contact | Company
OX Logo
Results 1 to 8 of 8
  1. #1
    liquidat Guest

    Default initconfigdb won't work

    Hi,

    I've installed the OpenXChange packages according to the wiki page http://www.open-xchange.com/wiki/ind...de_for_CentOS5.

    However, whenever I want to run
    Code:
    $ /opt/open-xchange/sbin/initconfigdb --configdb-pass=db_password -a
    I get the error:
    Code:
    /opt/open-xchange/sbin/initconfigdb --configdb-pass=somePwd -a                                                                               
    initializing configdb from scratch...ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)                                                   
    ERROR
    My mysql database already has a root password set, and the help of the command states that
    Code:
    NOTE: use "-a" to create SQL admin user using GRANT command
    so I decided to avoid the -a and tried it without:
    Code:
    /opt/open-xchange/sbin/initconfigdb --configdb-pass=somePwd
    initializing configdb from scratch...ERROR 1044 (42000) at line 1: Access denied for user 'openexchange'@'%' to database 'configdb'
    ERROR
    I'm a bit lost here. Any idea what the problem is? Do I have to use a mysql database without any root account? Looks a bit unsecure to me.

    Regards,

    liquidat

  2. #2
    Carsten Hoeger is offline Open-Xchange Professional Services
    Join Date
    Mar 2007
    Posts
    703

    Default

    root != open-xchange admin user.
    If you did set a root password, you need to unset it again because the initconfigdb script does not support that.

    You, however, must use -a in order to GRANT the privileges for the openexchange user.
    OXpedia.org - the answer to almost all questions.

  3. #3
    liquidat Guest

    Default

    Quote Originally Posted by Carsten Hoeger View Post
    root != open-xchange admin user.
    If you did set a root password, you need to unset it again because the initconfigdb script does not support that.

    You, however, must use -a in order to GRANT the privileges for the openexchange user.
    Thx for the reply - but unsetting the root password is like inviting everyone, it is administration's nightmare!
    So for that reason I at least need to set mysql to listen only on 127.0.0.1 - will initconfigdb still work in that case?

  4. #4
    Join Date
    Feb 2007
    Location
    Germany
    Posts
    3,695

    Default

    Hi,

    you need to remove the mysql root passwort just for the moment when running initconfigdb, afterwards you can set it again. Open-Xchange will access the database using an own user account which is created by those scripts - for creating the Open-Xchange database user we need "root" access to the database.
    By the way - the default configuration of MySQL is to listen only on localhost.

    Greetings
    Last edited by Martin Heiland; 03-22-2009 at 02:39 AM.

  5. #5
    rayk_sland Guest

    Default Try this initconfigdb instead...

    #!/bin/bash
    #
    #
    # OPEN-XCHANGE legal information
    #
    # All intellectual property rights in the Software are protected by
    # international copyright laws.
    #
    #
    # In some countries OX, OX Open-Xchange, open xchange and OXtender
    # as well as the corresponding Logos OX Open-Xchange and OX are registered
    # trademarks of the Open-Xchange, Inc. group of companies.
    # The use of the Logos is not covered by the GNU General Public License.
    # Instead, you are allowed to use these Logos according to the terms and
    # conditions of the Creative Commons License, Version 2.5, Attribution,
    # Non-commercial, ShareAlike, and the interpretation of the term
    # Non-commercial applicable to the aforementioned license is published
    # on the web site http://www.open-xchange.com/EN/legal/index.html.
    #
    # Please make sure that third-party modules and libraries are used
    # according to their respective licenses.
    #
    # Any modifications to this package must retain all copyright notices
    # of the original copyright holder(s) for the original code used.
    #
    # After any such modifications, the original and derivative code shall remain
    # under the copyright of the copyright holder(s) and/or original author(s)per
    # the Attribution and Assignment Agreement that can be located at
    # http://www.open-xchange.com/EN/developer/. The contributing author shall be
    # given Attribution for the derivative code and a license granting use.
    #
    # Copyright (C) 2004-2006 Open-Xchange, Inc.
    # Mail: info@open-xchange.com
    #
    #
    # This program is free software; you can redistribute it and/or modify it
    # under the terms of the GNU General Public License, Version 2 as published
    # by the Free Software Foundation.
    #
    # 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., 59
    # Temple Place, Suite 330, Boston, MA 02111-1307 USA
    #
    #


    OXFUNCTIONS=/opt/open-xchange/etc/oxfunctions.sh
    ADMINCONF=/opt/open-xchange/etc/admindaemon


    test -f $OXFUNCTIONS || {
    echo "missing common shell functions file"
    exit 1
    }

    . $OXFUNCTIONS

    # some defaults
    CONFIGDB_ROOT=
    CONFIGDB_ROOT_LONG=admin-user
    CONFIGDB_ROOTPW=
    CONFIGDB_ROOTPW_LONG=admin-password
    CONFIGDB_USER=openexchange
    CONFIGDB_USER_LONG=configdb-user
    CONFIGDB_PASS=
    CONFIGDB_PASS_LONG=configdb-pass
    CONFIGDB_HOST=localhost
    CONFIGDB_HOST_LONG=configdb-host
    CONFIGDB_PORT=3306
    CONFIGDB_PORT_LONG=configdb-port
    CONFIGDB_DBNAME=configdb
    CONFIGDB_DBNAME_LONG=configdb-dbname

    # default is NOT to create sql admin user
    CREATEADMIN=
    DLETETECONFIGDB=

    MUSTOPTS="CONFIGDB_PASS CONFIGDB_ROOT CONFIGDB_ROOTPW"
    LONGOPTS='$CONFIGDB_ROOT_LONG:,$CONFIGDB_ROOTPW_LO NG:,$CONFIGDB_USER_LONG:,$CONFIGDB_PASS_LONG:,$CON FIGDB_HOST_LONG:,$CONFIGDB_PORT_LONG:,$CONFIGDB_DB NAME_LONG:'

    usage() {
    echo
    echo "$0 currently knows the following parameters:"
    echo
    local lopts=$(echo $LONGOPTS | sed -e 's/[:,]/ /g')
    printf '%-30s | %s\n' "Parameter" "Default value"
    echo "------------------------------------------------------------"
    for opt in $lopts; do
    local rvar=${opt%_LONG}
    local default=$(eval echo $rvar)
    local lopt=$(eval echo $opt)
    #echo $opt $rvar $default $lopt
    printf '%-30s | %s\n' "--$lopt" $default
    done
    echo
    echo
    echo 'NOTE: use "-a" to create SQL admin user using GRANT command'
    echo use "-i" to automatically delete the configdb if exists
    echo
    echo
    cat<<EOF
    Example:

    $0 --configdb-pass=secret
    EOF
    echo
    }

    TEMP=$(POSIXLY_CORRECT=true getopt -o iap:h --long "$(eval echo $LONGOPTS),help" -- "$@")
    eval set -- "$TEMP"

    while true; do
    case "$1" in
    --$CONFIGDB_ROOT_LONG)
    CONFIGDB_ROOT=$2
    shift 2
    ;;
    --$CONFIGDB_ROOTPW_LONG)
    CONFIGDB_ROOTPW=$2
    shift 2
    ;;
    --$CONFIGDB_USER_LONG)
    CONFIGDB_USER=$2
    shift 2
    ;;
    --$CONFIGDB_PASS_LONG)
    CONFIGDB_PASS=$2
    shift 2
    ;;
    --$CONFIGDB_HOST_LONG)
    CONFIGDB_HOST=$2
    shift 2
    ;;
    -p|--$CONFIGDB_PORT_LONG)
    CONFIGDB_PORT=$2
    shift 2
    ;;
    --$CONFIGDB_DBNAME_LONG)
    CONFIGDB_DBNAME=$2
    shift 2
    ;;
    -a)
    CREATEADMIN=true
    shift
    ;;
    -i)
    DLETETECONFIGDB=true
    shift
    ;;
    -h|--help)
    usage
    exit 1
    shift
    ;;
    --)
    shift
    break
    ;;
    *)
    die "Internal error!"
    exit 1
    ;;
    esac
    done

    # generic parameter checking
    for opt in $MUSTOPTS; do
    opt_var=$(eval echo \$$opt)
    opt_var_long=$(eval echo \$${opt}_LONG)
    opt_var_values=$(eval echo \$${opt}_VALUES)
    if [ -z "$opt_var" ]; then
    usage
    die "missing required option --$opt_var_long"
    fi
    if [ -n "$opt_var_values" ]; then
    found=
    for val in $opt_var_values; do
    if [ "$val" == "$opt_var" ]; then
    found=$val
    fi
    done
    if [ -z "$found" ]; then
    die "\"$opt_var\" is not a valid option to --$opt_var_long"
    fi
    fi
    done

    if [ -n "$CREATEADMIN" ]; then
    if [ "$USER" != "root" ]; then
    die "need to be root in order to setup the system"
    fi
    fi

    if [ "$(mysql -h $CONFIGDB_HOST -P $CONFIGDB_PORT -u $CONFIGDB_ROOT -p${CONFIGDB_ROOTPW} -e "show databases;" -B 2>/dev/null | grep ${CONFIGDB_DBNAME})" == ${CONFIGDB_DBNAME} ] && [ "$DLETETECONFIGDB" != "true" ]; then
    die "the database $CONFIGDB_DBNAME exists, use the -i switch if you want to automatically delete it"
    fi

    echo -n "initializing configdb from scratch..."

    if [ -n "$CREATEADMIN" ]; then
    cat<<EOF | mysql -u $CONFIGDB_ROOT -p${CONFIGDB_ROOTPW}|| die
    drop database if exists \`${CONFIGDB_DBNAME}\`;
    GRANT ALL PRIVILEGES ON *.* TO '$CONFIGDB_USER'@'%' IDENTIFIED BY '$CONFIGDB_PASS' WITH GRANT OPTION;
    GRANT ALL PRIVILEGES ON *.* TO '$CONFIGDB_USER'@'localhost' IDENTIFIED BY '$CONFIGDB_PASS' WITH GRANT OPTION;
    create database \`${CONFIGDB_DBNAME}\`;
    EOF
    mysqladmin -u $CONFIGDB_ROOT -p${CONFIGDB_ROOTPW} flush-privileges || die
    else
    cat<<EOF | mysql -h $CONFIGDB_HOST -P $CONFIGDB_PORT -u $CONFIGDB_USER -p${CONFIGDB_PASS} || die
    drop database if exists \`${CONFIGDB_DBNAME}\`;
    create database \`${CONFIGDB_DBNAME}\`;
    EOF
    fi

    cat $ADMINCONF/mysql/configdb.sql \
    | mysql -h $CONFIGDB_HOST -P $CONFIGDB_PORT -u $CONFIGDB_USER -p${CONFIGDB_PASS} ${CONFIGDB_DBNAME} || die

    echo " done"

  6. #6
    rayk_sland Guest

    Default obviously

    obviously watch for appropriate line breaks in the above script.

  7. #7
    liquidat Guest

    Default

    Thanks, I reset the password, actually removed mysql entirely, reinstalled it, set it to 127.0.0.1 (centos packages don't do that automatically, unfortunatelly), and re-installed openxchange - worked.

    @rayk_sland: Thanks for the script, but the above mentioned method worked before you've posted the script. Still, thanks

  8. #8
    Join Date
    Sep 2009
    Location
    Almere Nederland
    Posts
    10

    Default

    "reinstalled it, set it to 127.0.0.1 (centos packages don't do that automatically, unfortunatelly)"

    Uhhh yeah they do!! as a matter of fact I am having a hard time getting it to listen anywhere else then the localhostIP.
    grtz,

    B.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •