Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 208077 - mysql 5.0.54 /usr/bin/mysql_install_db fails if hostname is localhost
Summary: mysql 5.0.54 /usr/bin/mysql_install_db fails if hostname is localhost
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-01-29 18:48 UTC by Alexey Guzeev
Modified: 2008-01-29 21:05 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Alexey Guzeev 2008-01-29 18:48:54 UTC
/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).