Skip to content
Snippets Groups Projects
Closed $dbusername/$dbuserpassword can't be specified without $configfile
  • View options
  • $dbusername/$dbuserpassword can't be specified without $configfile

  • View options
  • Closed Issue created by Ghost User

    Assuming the following config file:

    dbusername  = mysqluser
    dbpassword  = mysqlpassword
    backupdir   = /usr/local/mysql_backup
    hotcopy     = no
    sqldump     = yes
    compress    = yes
    

    @defaultsfile@ is set to "@--defaults-extra-file=/etc/mysql/debian.cnf@" and the dynamically generated content in @workcnf/$mycnf@ is disregarded.

    This patch against HEAD resolves that behaviour by assuming the following order of precedence:

    @dbusername@/@dbpassword@

    @$user@

    @$configfile@ (default)

    --- a/handlers/mysql.in 2010-04-30 13:45:14.802811874 +0100
    +++ b/handlers/mysql.in 2010-04-30 14:55:23.784512949 +0100
    @@ -86,7 +86,7 @@
    
     defaultsfile=""
    
    -if [ "$dbusername" != "" -a "$dbpassword" != "" ]
    +if [ -n "$dbusername" -a -n "$dbpassword" ]
     then
        if [ $usevserver = yes ]
        then
    @@ -140,13 +140,8 @@
     EOF
        umask $oldmask
        defaultsfile="--defaults-extra-file=$mycnf"
    -fi
    -
    -# if a user is not set, use $configfile, otherwise use $mycnf
    -if [ "$user" == "" ]; then
    -   user=root;
    -   defaultsfile="--defaults-extra-file=$configfile"
    -else
    +# if a user is set use $configfile
    +elif [ -n "$user" ]; then
        userset=true;
        if [ $usevserver = yes ]
        then
    @@ -169,6 +164,10 @@
    
        defaultsfile="--defaults-extra-file=$userhome/.my.cnf"
        debug "using $defaultsfile"
    +# otherwise use $mycnf
    +else
    +   user=root;
    +   defaultsfile="--defaults-extra-file=$configfile"
     fi
    
     #######################################################################
    

    (from redmine: created on 2010-04-29, closed on 2010-06-24)

    Linked items ... 0

  • Activity

    • All activity
    • Comments only
    • History only
    • Newest first
    • Oldest first
    Loading Loading Loading Loading Loading Loading Loading Loading Loading Loading