Changeset 1914

Show
Ignore:
Timestamp:
08/27/07 18:33:31 (9 months ago)
Author:
anarcat
Message:

instead of assuming that SHOW TABLES; gives us GRANT privileges, simply try to GRANT with our multiple techniques

Fixes: #1060

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • alternc/trunk/install/mysql.sh

    r1880 r1914  
    4343mysql="/usr/bin/mysql --defaults-file=/etc/mysql/debian.cnf -h$sqlserver " 
    4444 
    45 if ! $mysql mysql -e "SHOW TABLES" >/dev/null 
    46 then 
    47     # is this an upgrade then? 
    48     mysql="/usr/bin/mysql -h$sqlserver -u$rootlogin -p$rootpass"  
    49     if ! $mysql mysql -e "SHOW TABLES" >/dev/null 
    50     then 
    51         echo "Can't get proper credentials, aborting" 
    52         exit 1 
    53     fi 
    54 fi 
    55  
    5645# The grant all is the most important right needed in this script. 
    5746# If this call fail, we may be connected to a mysql-server version 5.0. 
    5847echo "Granting users " 
    59     # In that case, change mysql parameters and retry. Use root / nopassword. 
     48# In that case, change mysql parameters and retry. Use root / nopassword. 
    6049$mysql -e "GRANT ALL ON *.* TO '$rootlogin'@'${MYSQL_CLIENT}' IDENTIFIED BY '$rootpass' WITH GRANT OPTION" 
    6150if [ "$?" -ne "0" ] 
    6251then 
    63     echo "You are using mysql 5.0, so we try with root account and no password since debian-sys-maint doesn't work." 
    64     mysql="/usr/bin/mysql -h$sqlserver -uroot " 
    65     echo "Granting users " 
     52    echo "debian-sys-maintainer doesn't have the right credentials, assuming we're doing an upgrade" 
     53    mysql="/usr/bin/mysql -h$sqlserver -u$rootlogin -p$rootpass"  
    6654    $mysql -e "GRANT ALL ON *.* TO '$rootlogin'@'${MYSQL_CLIENT}' IDENTIFIED BY '$rootpass' WITH GRANT OPTION" 
    6755    if [ "$?" -ne "0" ]  
    6856        then  
    69         echo "Can't grant system user $rootlogin, abording";  
    70         exit 1  
     57        echo "Still not working, assuming clean install and empty root password" 
     58        mysql="/usr/bin/mysql -h$sqlserver -uroot " 
     59        $mysql -e "GRANT ALL ON *.* TO '$rootlogin'@'${MYSQL_CLIENT}' IDENTIFIED BY '$rootpass' WITH GRANT OPTION" 
     60        if [ "$?" -ne "0" ]  
     61        then  
     62            echo "Can't grant system user $rootlogin, abording";  
     63            exit 1  
     64        fi 
    7165    fi 
    7266fi