Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 79151 (mysql_install_db_bad) - mysql_install_db patch...
Summary: mysql_install_db patch...
Status: RESOLVED WONTFIX
Alias: mysql_install_db_bad
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Linux MySQL bugs team
URL:
Whiteboard:
Keywords:
: 82366 (view as bug list)
Depends on:
Blocks:
 
Reported: 2005-01-22 15:44 UTC by Eric Brown
Modified: 2006-11-29 23:27 UTC (History)
2 users (show)

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 Eric Brown 2005-01-22 15:44:36 UTC
We should patch mysql_install_db to add -p to the second mysqladmin line since setting the password in the first one requires a password in order to run the second one.. I swear i submitted a patch before...

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-02-13 20:31:02 UTC
you did submit a patch, and we rejected it, just like upstream did.
it does not always require a -p on the second mysqladmin line.
it depends on the context you are connecting from (which in turn depends on how your machine is configured).

the message from mysqladmin is:
1. mysqladmin -u root -h $hostname password 'new-password'
2. mysqladmin -u root password 'new-password'

If mysql resolves your connecting IP back to the hostname you specified in #1, then it requires a password for operation #2. If it resolves to a different hostname, then it does not require a password in #2. The same holds true if you switch the order of the commands around.

The source of this problem is that machines have $hostname as 'localhost', or if they put their own hostname in /etc/hosts as 127.0.0.1. I'd consider machines where that is the case to be misconfigured.
Comment 2 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2005-02-17 09:07:56 UTC
*** Bug 82366 has been marked as a duplicate of this bug. ***
Comment 3 Gilles Espinasse 2006-11-29 23:27:19 UTC
The actual explanation fail to state what are the requirements to make the two commands possible (dev-db/mysql-5.0.26-r1).

I don't understand how my machine could be misconfigured because the same sort of command work when done from mysql (and not mysqladmin)

barton ~ # hostname
barton
barton ~ # hostname -f
barton.maison
barton ~ # rm -rf /var/lib/mysql/*
barton ~ # /usr/bin/mysql_install_db
Installing all prepared tables
Fill help tables

To start mysqld at boot time you have to copy support-files/mysql.server
to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h barton password 'new-password'
See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with the benchmarks in the 'sql-bench' directory:
cd sql-bench ; perl run-all-tests

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
barton ~ # /etc/init.d/mysql start
 * Starting mysql ...
 * Starting mysql (/etc/mysql/my.cnf)                                     [ ok ]
barton ~ # /usr/bin/mysqladmin -u root password 'new-password'
barton ~ # /usr/bin/mysqladmin -u root -h barton password 'new-password'
/usr/bin/mysqladmin: connect to server at 'barton' failed
error: 'Lost connection to MySQL server during query'
barton ~ # /etc/init.d/mysql stop
 * Stopping mysql ...
 * Stopping mysqld (0)                                                    [ ok ]
barton ~ # rm -rf /var/lib/mysql/*
barton ~ # /usr/bin/mysql_install_db
...
barton ~ # /etc/init.d/mysql start
 * Starting mysql ...
 * Starting mysql (/etc/mysql/my.cnf)                                     [ ok ]
barton ~ # /usr/bin/mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.26-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> SET PASSWORD FOR 'root'@'localhost' = PASSWORD('nouveau_pass');
Query OK, 0 rows affected (0.00 sec)

mysql> SET PASSWORD FOR 'root'@'barton' = PASSWORD('nouveau_pass_2');           Query OK, 0 rows affected (0.00 sec)

So what the requirements to make work
mysqladmin -u root -h $hostname password 'new-password'
Is-it really what should be done?