Hi,

I'm having the same problem. The file /etc/mysql/debian.cnf does not contain a 
mysql_upgrade section, just a client one. And running dpkg-reconfigure 
mysql-server-5.0 does not change this. 

I have created a patch that creates the section if it doesn't exist. I have 
tested it on my own system and it works.

It also seems like /usr/bin/mysql_upgrade might need the second attached 
patch. Otherwise mysql_upgrade fails if --force isn't used, even if the 
defaults-file is correct.

// Erik

-- 
Oh, people can come up with statistics to prove anything. 
14% of people know that.
  -- Homer Simpson

Erik Johansson
http://ejohansson.se
--- mysql_upgrade-ORG	2006-05-04 23:11:41.000000000 +0200
+++ mysql_upgrade	2006-05-04 23:12:25.000000000 +0200
@@ -179,7 +179,7 @@
     then
        echo "mysql_upgrade already done for this version"
     fi
-    $bindir/mysql_fix_privilege_tables --silent $args
+    $bindir/mysql_fix_privilege_tables --silent --user=$user --password=$password $args
     exit 0
   fi
 fi
--- /var/lib/dpkg/info/mysql-server-5.0.postinst	2006-04-28 23:50:05.000000000 +0200
+++ mysql-server-5.0.postinst	2006-05-04 23:44:29.000000000 +0200
@@ -126,13 +126,20 @@
     #   As the binlog cron scripts to need at least the Super_priv, I do first
     #   the old query which always succeeds and then the new which may or may not.
 
-    # recreate the credentials file
+    # get current password or create a new
     dc=$mysql_cfgdir/debian.cnf; 
     if [ -e "$dc" ]; then
         pass="`sed -n 's/password *= *// p' $dc`"
     else
 	pass=`perl -e 'print map{("a".."z","A".."Z",0..9)[int(rand(62))]}(1..16)'`;
-        if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi
+    fi
+    if [ ! -d "$mysql_cfgdir" ]; then install -o 0 -g 0 -m 0755 -d $mysql_cfgdir; fi
+    
+    # recreate the credentials file if it doesn't
+    # - exist
+    # - contain a client section
+    # - contain a mysql_upgrade section
+    if test ! -e "$dc" || ! grep -q "\[client\]" "$dc" || ! grep -q "\[mysql_upgrade\]" "$dc"; then
         cat /dev/null > $dc
         echo "# Automatically generated for Debian scripts. DO NOT TOUCH!" >>$dc
         echo "[client]"                                                    >>$dc

Reply via email to