Bug #27022 Install fails with Duplicate entry '%-test-' for key 'PRIMARY'
Submitted: 10 Mar 2007 10:52 Modified: 6 Apr 2007 18:06
Reporter: Ingo Strüwing Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Installing Severity:S1 (Critical)
Version:5.0.38, 5.1.17 OS:Linux (Linux)
Assigned to: Magnus Blåudd CPU Architecture:Any

[10 Mar 2007 10:52] Ingo Strüwing
Description:
make install fails in both 5.0 and 5.1:

5.0:
...
make[1]: Leaving directory `/home2/mytest/mysql-5.0-main'
++ /home/mytest/install-5.0-main/bin/mysql_install_db --no-defaults
Installing MySQL system tables...
ERROR: 1062  Duplicate entry '%-test-' for key 1
070309 20:11:29 [ERROR] Aborting

070309 20:11:29 [Note] /home/mytest/install-5.0-main/libexec/mysqld: Shutdown complete

Installation of system tables failed!
...

5.1:
...
make[1]: Leaving directory `/home2/mytest/mysql-5.1-main'
++ /home/mytest/install-5.1-main/bin/mysql_install_db --no-defaults
Installing MySQL system tables...
ERROR: 1582  Duplicate entry '%-test-' for key 'PRIMARY'
070309 20:40:54 [ERROR] Aborting

070309 20:40:54 [Note] /home/mytest/install-5.1-main/libexec/mysqld: Shutdown complete

Installation of system tables failed!
...

How to repeat:
bk clone bk-internal.mysql.com:/home/bk/mysql-5.1 'mysql-5.1-main'
cd 'mysql-5.1-main'
BUILD/compile-pentium-debug-max --with-debug=full --prefix="/home/mytest/install-5.1-main"
make install
[13 Mar 2007 14:01] Magnus Blåudd
Looking...
[13 Mar 2007 14:11] Magnus Blåudd
This probably occurs when you install on top of an already installed version. When trying to insert the default values into mysql.user a second time.
[13 Mar 2007 14:17] Magnus Blåudd
Problem is that we run mysql_install_db although we already have an installed db. Hence we should detect that and run mysql_upgrade instead.
[13 Mar 2007 15:25] Magnus Blåudd
mysql_install_db should protect the MySQL system and user tables at all cost. Thus it should produce an error message when detecting that the MySQL System tables already exist in the given install location.
[16 Mar 2007 10:52] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/22115

ChangeSet@1.2466, 2007-03-16 11:52:30+01:00, msvensson@pilot.blaudden +1 -0
  Bug#27022 Install fails with Duplicate entry '%-test-' for key 'PRIMARY'
   - Bail out with error if MySQL System tables already exist
[6 Apr 2007 17:21] Bugs System
Pushed into 5.0.40
[6 Apr 2007 17:23] Bugs System
Pushed into 5.1.18-beta
[6 Apr 2007 18:06] Paul Dubois
Noted in 5.0.40, 5.1.18 changelogs.

mysql_install_db could terminate with an error after failing to
determine that a system table already existed.
[25 Aug 2007 17:48] Aaron
Since this was patched, I have been having this problem:

http://bugs.mysql.com/bug.php?id=29378

I think they may be related.