Skip Menu | Logged in as guest | Logout
 
Ticket metadata
Id: 2906
Status: resolved
Priority: 4/0
Queue: vdt-internal

Fixed in: 1.8.1
Fix scheduled: (no value)

Owner: Tim Cartwright
Requestors: Tim Cartwright
Cc:
AdminCc:

New reminder:

Created: Wed Aug 15 16:06:50 2007
Starts: Not set
Started: Fri Aug 17 16:20:38 2007
Last Contact: Not set
Due: Not set
Closed: Tue Aug 21 11:16:30 2007
Updated: Tue Nov 17 13:13:45 2009 by guest



History Brief headersFull headers
Subject: Force MySQL to have a fully-qualified hostname for root
Download (untitled) / with headers
text/plain 1.5k
If MySQL is installed on a machine for which hostname does not return the fully-
qualified hostname, subsequent attempts to access MySQL using the hostname as
the MySQL 'root' user will fail.

The mysql_install_db script, when creating the authorization tables in the mysql
database, uses the `hostname` system call to get the hostname. MySQL checks to
make sure it's a valid hostname by checking to see if it resolves OK, and that's
it. So, we end up with hosts for the 'root' user in the user table like this:

% mysql/bin/mysql -u root -BN -e 'SELECT Host FROM mysql.user WHERE User = "root"'
localhost
vdt-rhas3-ia32

However, when attempting to connect to MySQL using the -h (hostname) option, it
seems that MySQL resolves the hostname to its fully-qualified hostname (FQHN)
before authorizing:

% mysql/bin/mysql -u root -h vdt-rhas3-ia32
ERROR 1045 (28000): Access denied for user 'root'@'vdt-rhas3-ia32.cs.wisc.edu' (using password: NO)

So, our idea is to add the FQHN as a host for the 'root' user when the FQHN is
not already in the table. We can probably do this is configure_mysql, although
it's not clear exactly where would be best.

To see if the FQHN is present or not, you can run a command like this:

mysql/bin/mysql -u root -BN -e 'SELECT Host FROM mysql.user WHERE User = "root" AND Host != "localhost"'

If the FQHN is absent from the output, it is absent from the user table.

Connecting to MySQL with the 'root' user, the correct GRANT statement looks like
this:

GRANT ALL PRIVILEGES ON *.* TO 'root'@'vdt-rhas3-ia32.cs.wisc.edu' WITH GRANT OPTION

(Obviously, replace the hostname with the real FQHN.)