/usr/bin/mysql_install_db fails with mysql 5.0.54 if non-default hostname is not configured (yet, if needed at all at many setups). The problem is 'new' comparing with the previous stable, 5.0.44. The problem is tracked down to the following added line within /usr/share/mysql/mysql_system_tables_data.sql (mysql-5.0.54/scripts/mysql_system_tables_data.sql): INSERT INTO tmp_user (host,user) VALUES (@current_hostname,''); To fix, the line should be changed with 'REPLACE INTO tmp_user ...' Moreover, please consider filtering out the lines containing 'current_hostname' altogether. Having the external hostname is of no real use, as local db administration goes using logins 'localhost'/'root' or '127.0.0.1'/'root' defined higher; but having external hostname enabled too begs for serious security troubles if there are problems/attack with rDNS, or if hostname changes after mysql installation (and old hostname [much] later assigned to untrusty party). An elegant way to do such filter might be providing mysql_system_tables_data.sql invocation (from /usr/portage/eclass/mysql.eclass) with --cross-bootstrap parameter, and also a suitable --srcdir parameter needed then. --cross-bootstrap descrition is somewhat misleading but looks like it does exactly what is needed: filters out current_hostname outsmartery, plus does a couple of other useful things like dropping few unneeded messages including those about non-gentoo compatible mysqld start, and warning about root user password setup (which /usr/portage/eclass/mysql.eclass already takes care of). While at here, I see that /usr/portage/eclass/mysql.eclass manually feeds mysql with fill_help_tables.sql content, which is not needed as mysql_install_db does that itself (since at least 5.0.19).