ERROR: database mysql is not available

Bug #1465099 reported by yuchuan zhang
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
kolla
Invalid
Critical
Unassigned

Bug Description

following the below guide to start kolla , but I meet the error: database mysql is not available, so the keystone fail to start.
https://github.com/stackforge/kolla/blob/master/docs/dev-quickstart.md

by debugging this issue, I find the root cause is that the compose_keystone_1 container cannot connect to compose_mariadbapp_1 with the below error:

[root@ ~]# mysql -h <IP> -uroot -pkolla
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'root'@'HOSTNAME' (using password: YES)

The code segment raising this error is here:
check_for_db() {
    local database=${1:-mysql}
    check_required_vars MARIADB_SERVICE_HOST DB_ROOT_PASSWORD

    mysql -h ${MARIADB_SERVICE_HOST} -u root -p"${DB_ROOT_PASSWORD}" \
            -e "select 1" $database > /dev/null 2>&1 || {
        echo "ERROR: database $database is not available @ $MARIADB_SERVICE_HOST" >&2
        return 1
    }

    echo "database is active @ ${MARIADB_SERVICE_HOST}"
}

so I use the below steps to fix this issue manually:
1. delete from mysql.user where user='root' and host='<IP>';
2. delete from mysql.user where user='root' and host='';
3. flush privileges;
3. grant all privileges on *.* to 'root'@'<IP>' identified by 'kolla' with grant option;

description: updated
description: updated
Revision history for this message
Steven Dake (sdake) wrote :

I'm not sure what the exact cause of this problem is, or why the suggested workaround works, but I have marked it critical for liberty-2 to fix, because it is a serious problem that seems to happen to me about 10% of the kolla start operations.

Changed in kolla:
status: New → Confirmed
importance: Undecided → Critical
milestone: none → liberty-2
Revision history for this message
Vladislav Belogrudov (vlad-belogrudov) wrote :

This is an expected default behavior - you cannot log from remote host as root (remote means using -h). Yuchuan provided working solution that is used elsewhere (e.g. in puppet - https://github.com/puppetlabs/puppetlabs-mysql/blob/master/manifests/server/account_security.pp ). It seems the troublemakers are the entries with empty host names (mysql.hosts table has to be referenced then but the latter usually is empty). After deletion of empty host entries everything works as wanted. The init script of container should do proper account preparation and deletion of test database

Revision history for this message
Vladislav Belogrudov (vlad-belogrudov) wrote :
Revision history for this message
Imran Hayder (hayderimran7) wrote :

was having same issue. but doesnt happen anymore for me after i build the latest images myself as :
./tools/build-all-docker-images --tag latest --release

Steven Dake (sdake)
Changed in kolla:
milestone: liberty-2 → liberty-3
Revision history for this message
Steven Dake (sdake) wrote :

We have removed config-internal support and this only happens with config-internal so marking invalid.

Changed in kolla:
status: Confirmed → Invalid
milestone: liberty-3 → none
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.