Bug #39208 Confusing content at output of mysql_install_db
Submitted: 3 Sep 2008 10:00 Modified: 4 Oct 2010 10:05
Reporter: Sam Sexton Email Updates:
Status: Duplicate Impact on me:
None 
Category:MySQL Server: Installing Severity:S3 (Non-critical)
Version:5.0, 5.1 OS:Linux (Solars 10 32-bit, FreeBSD)
Assigned to: Assigned Account CPU Architecture:Any
Tags: DEFAULT, installation, password

[3 Sep 2008 10:00] Sam Sexton
Description:
I have installed MySQL 5.0.67 from http://dev.mysql.com/downloads/mysql/5.0.html#solaris-pgadd (Solaris 10 32-bit)
and am unable to change the root password.

Originally, I hit bug 31164 (problem with pkgadd and permission on /var/tmp/install* in the postinstall script). When that failed, I was able to connect as suggested and show that there no tables had been created. However, when I applied the workaround for that bug and the installation completed successfully, the instructions for changing the password failed - it appears that there's a defaul password that is not empty and that I haven't been
able to find, despite hunting around for yonks!

I'm told this:

## Executing postinstall script.
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/mysql/bin/mysqladmin -u root password 'new-password'
/opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 password 'new-password'

but ...

# /etc/init.d/mysql start
Starting MySQL
. SUCCESS! 

# /opt/mysql/mysql/bin/mysqladmin -u root password 'doofernow'
/opt/mysql/mysql/bin/mysqladmin: connect to server at 'localhost' failed
# /opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 password 'doofernow'
/opt/mysql/mysql/bin/mysqladmin: connect to server at 'ntm-igdev02' failed
error: 'Host 'ntm-igdev02' is not allowed to connect to this MySQL server'

# mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO) 

How to repeat:
As above after initial installation.
[3 Sep 2008 10:17] Giuseppe Maxia
Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://dev.mysql.com/doc/ and the instructions on
how to report a bug at http://bugs.mysql.com/how-to-report.php

This is expected behavior. The password should be indicated withe the "--password" or ("-P") option (with the dashes).

This is wrong:
/opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 password 'doofernow'

it should be:
/opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 --password=doofernow
or
/opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 -Pdoofernow

and, besides, after changing password, you should use the command line client. (mysqladmin requires a specific command after the options)

/opt/mysql/mysql/bin/mysql -u root -h ntm-igdev02 -Pdoofernow
[3 Sep 2008 10:40] Sam Sexton
Many thanks for the very quick response, Guiseppe, but I still have problems. I should point out that the syntax I was using was as shown at the end of the installation process. 

I tried your suggestions, firstly both without the -h option and then with it - the first option displayed the usage blurb:

[639](root@ntm-igdev02)/var/tmp: /opt/mysql/mysql/bin/mysqladmin -u root --password=doofernow 
/opt/mysql/mysql/bin/mysqladmin  Ver 8.41 Distrib 5.0.67, for sun-solaris2.10 on sparc
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Administration program for the mysqld daemon.
Usage: /opt/mysql/mysql/bin/mysqladmin [OPTIONS] command command....

and the second thought I was trying to assign a port, so I changed -P to -p and that also gave me the Usage:

[641](root@ntm-igdev02)/var/tmp: /opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 -Pdoofernow
Unknown suffix 'd' used for variable 'port' (value 'doofernow')
/opt/mysql/mysql/bin/mysqladmin: Error while setting value 'doofernow' to 'port'

[642](root@ntm-igdev02)/var/tmp: /opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 -pdoofernow
/opt/mysql/mysql/bin/mysqladmin  Ver 8.41 Distrib 5.0.67, for sun-solaris2.10 on sparc
Copyright (C) 2000-2006 MySQL AB
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL license

Administration program for the mysqld daemon.
Usage: /opt/mysql/mysql/bin/mysqladmin [OPTIONS] command command....

I then tried mysql using the new password (although I knoew it wasn't going to work!):

[643](root@ntm-igdev02)/var/tmp: mysql -u root -p                                                  
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[644](root@ntm-igdev02)/var/tmp:

I believe that somehow a root password has been assigned, but I can't tell what it is. I suspected the postinstall script, but couldn't see anything likely.
[3 Sep 2008 11:01] Giuseppe Maxia
Sam,
please use the forums for this kind of problems. This is not a bug issue.
http://forums.mysql.com

Giuseppe
[5 Sep 2008 11:14] Sam Sexton
Hi - are there any more thoughts on this problem, please? I've reinstalled a couple of times to ensure it wasn't a transient gremlin and it ain't. Sigh.
[5 Sep 2008 11:19] Sam Sexton
I wasn't ignoring Giuseppe's last comment, but it didn't reach me by mail and I only saw it after submitting my update a few mins ago. I'll try the forum.
[12 Sep 2008 11:11] Sergei Golubchik
It is a bug if the installation ends with
"
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/opt/mysql/mysql/bin/mysqladmin -u root password 'new-password'
/opt/mysql/mysql/bin/mysqladmin -u root -h ntm-igdev02 password 'new-password'
"

and these commands don't work.
[15 Sep 2008 11:17] Sam Sexton
Thanks Sergei, I'm glad you agree! A colleague who is far more familiar with MySQL than I has helped me out with this and the problem was due to these factors:

1. mysql defaulted to using /usr/local/mysql/data rather than /var/lib/mysql.
2. The root user wasn't added to the table.
3. The multiple data directories are rather confusing!

His corrective actions were as follows:

1. mysqld -umysql --datadir=/var/lib/mysql/ --skip-grant-table
2. manually added user 'root' to table user
3. killed mysqld
4. started mysql through the script /etc/init.d/...
5. mysql -uroot (takes you to database straight away)
6. issued command: grant all privileges on *.* to 'root'@'localhost' identified by 'pass';

I've just added a record for the local hostname and changed the password, but as this is a development system and I'll be rerunning the procedure for the production installation, I'd rather reinstall cleanly, so will await news on a new release or changed documentation. If you need any more information or investigation, please let me know.

Many thanks.
[15 Sep 2008 13:31] Susanne Ebrecht
MySQL 5.0 bzr:

$ ./bin/mysql_install_db

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/home/miracee/mysql50bzr/bin/mysqladmin -u root password 'new-password'
/home/miracee/mysql50bzr/bin/mysqladmin -u root -h swedishchef password 'new-password'

The same in MySQL 5.1 bzr tree:

$ ./bin/mysql_install_db

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:

/home/miracee/mysql51bzr/bin/mysqladmin -u root password 'new-password'
/home/miracee/mysql51bzr/bin/mysqladmin -u root -h swedishchef password 'new-password'
[15 Sep 2008 15:01] Sam Sexton
Hi Susanne,

Forgive me, but I'm not sure what the point of your update was - that's what I got, but the commands didn't work - these are from immediately after the installation of the package:

[614](root@ntm-igdev02)/var/.../install: mysql -u root mysql
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[615](root@ntm-igdev02)/var/.../install: mysql -u root -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
[616](root@ntm-igdev02)/var/.../install: 

BTW, I like your host name!
[16 Sep 2008 9:52] Susanne Ebrecht
On FreeBSD:

$ ./bin/mysqladmin -u root password -h swedishchef 'new-pw'
./bin/mysqladmin: connect to server at 'swedishchef' failed
error: 'Unknown MySQL server host 'swedishchef' (1)'
Check that mysqld is running on swedishchef and that the port is 6951.
You can check this by doing 'telnet swedishchef 6951'
[16 Sep 2008 9:55] Susanne Ebrecht
This could be related to bug #31164. But it also happens on FreeBSD by using self compiled bzr tree. All other bugs I found were Solaris only.
[21 Sep 2008 23:14] Sam Sexton
Susanne, the info on this ticket claims the problem is on Linux, FreeBSD and Solaris - don't know how that happened, but I've only ever mentioned it being in Solaris 10. Hope this helps.
[21 Sep 2008 23:17] Sam Sexton
Hmm - I just realised how long ago you made that update - the email I got says:

Sent: Sun 21/09/2008 15:57

I'll check further when I'm awake (waiting on a customer problem at the moment), but there may be a delay at your end.
[22 Sep 2008 8:39] Sam Sexton
I've checked the history of Susanne's message [16 Sep 11:55] and it was indeed delayed at your end:

Received: (from apache@localhost)	by bugs.mysql.com (8.13.8/8.13.8/Submit)
 id m8LEv4eO022548; Sun, 21 Sep 2008 16:57:04 +0200
Date: Sun, 21 Sep 2008 16:57:04 +0200
From: Bug Database <do-not-reply@mysql.com>
Subject: #39208 [Com,Ver->Opn]: Confusing content at output of mysql_install_db

Ir appears that the problem has now cleared, but thought you should know about this.
[22 Sep 2008 11:22] Susanne Ebrecht
To clarify the OS setting here:

I can reproduce this behaviour with Ubuntu 8.04 on my laptop but I can't reproduce it with Ubuntu 8.04 on my PC.

I have no clue why.

I can reproduce this hardware independendt on FreeBSD 7.0 and on OpenSolaris.
[22 Sep 2008 12:23] Sam Sexton
Thanks for the clarification, Susanne - let me know if there's any investigation I can do on my system.
[2 Oct 2008 16:03] Werner Donné
I have applied the following post-installation procedure to make it work:

<<
After installing MySQL 5 on Solaris with pkgadd you will have to perform
the following post-installation tasks:
As root:
# rm -rf /var/lib/mysql/mysql
Then as mysql:
$ cd /opt/mysql/mysql
$ scripts/mysql_install_db
Then as root:
# /etc/init.d/mysql start
Then as mysql:
$ /opt/mysql/mysql/bin/mysqladmin -u root password 'password'
Then as root:
# /opt/mysql/mysql/bin/mysql_secure_installation
>>

Werner.
[14 Oct 2008 17:57] Valeriy Kravchuk
Bug #39966 is, likely, a duplicate of this one.
[15 Oct 2008 6:28] Sam Sexton
Many thanks Werner - I'm just back from holiday and will test that out in due course - I have a working system now, so will preserve that first.
[17 Oct 2008 14:48] Steven Brady
Werner's instructions worked for me.

SunOS xxxxx 5.10 Generic_127127-11 sun4v sparc SUNW,SPARC-Enterprise-T5220

Thanks,
Steve
[28 Sep 2010 19:00] Jonathan Perkin
I recently closed bug#31058 which should fix any issues on Solaris.

Are there still any outstanding issues to fix in this bug?
[4 Oct 2010 8:07] Sam Sexton
Thanks Jonathan - there's nothing else I know of that needs attention.
[4 Oct 2010 10:05] Jonathan Perkin
Ok, thanks!  Closing bug as a duplicate of bug#30158.
[4 Oct 2010 10:08] Jonathan Perkin
Er, typo, I meant bug#31058.