Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I am installing mtop on ubuntu 8.04 Mysql is running.

During the installation process there is a message:

Access denied for user 'root'@'localhost' (using password: NO)

(see below)

I suspect I have to allow access from unix user root to mysql account root somehow?

What are the correct steps?

$ sudo aptitude install mtop
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Building tag database... Done      
The following NEW packages will be automatically installed:
  libcurses-perl 
The following packages have been kept back:
  linux-image-server linux-server pm-utils 
The following NEW packages will be installed:
  libcurses-perl mtop 
0 packages upgraded, 2 newly installed, 0 to remove and 3 not upgraded.
Need to get 0B/168kB of archives. After unpacking 664kB will be used.
Do you want to continue? [Y/n/?] y
Writing extended state information... Done
Preconfiguring packages ...
Selecting previously deselected package libcurses-perl.
(Reading database ... 36744 files and directories currently installed.)
Unpacking libcurses-perl (from .../libcurses-perl_1.13-1_i386.deb) ...
Selecting previously deselected package mtop.
Unpacking mtop (from .../mtop_0.6.6-1.2_all.deb) ...
Setting up libcurses-perl (1.13-1) ...
Setting up mtop (0.6.6-1.2) ...
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
dpkg: error processing mtop (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 mtop
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up mtop (0.6.6-1.2) ...
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
dpkg: error processing mtop (--configure):
 subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
 mtop
Reading package lists... Done             
Building dependency tree       
Reading state information... Done
Reading extended state information      
Initializing package states... Done
Writing extended state information... Done
Building tag database... Done             

Edit: After reading the bugreport on launchpad I decided to go with the similar tool mytop in the old ubuntu editions.

share|improve this question

3 Answers 3

up vote 2 down vote accepted

First open start a mysql client using your root account:

mysql -u root -p

Than remove the root password only for localhost and flush the privileges:

UPDATE mysql.user SET Password=PASSWORD('') WHERE User='root' AND Host='localhost';FLUSH PRIVILEGES;

Now install mtop, for example:

sudo aptitude install mtop

After the installation set the password back to your oldpassword:

UPDATE mysql.user SET Password=PASSWORD('oldpassword') WHERE User='root' AND Host='localhost';FLUSH PRIVILEGES;

@JamesLawrie: I strongly suggest not supplying your password directly to the command, using only -p will prompt for your password, which prevents it from being logged to your shell history, see 5.3.2.2. End-User Guidelines for Password Security

@JamesLawrie: Specifying only access to the localhost improves the security aspect. In your example you use '%' which will enable remote root access without a password!

Although in the end, fixing this bug would probably be the best approach: https://bugs.launchpad.net/ubuntu/+source/mtop/+bug/77980

share|improve this answer
    
Thank you for making this clear! –  mit Nov 2 '10 at 17:57

This bug describes some workarounds and even alternative (PPA) packages:

https://bugs.launchpad.net/ubuntu/+source/mtop/+bug/77980

share|improve this answer

One hacky, horrible way to fix this is to remove the MySQL root password first for localhost, then add it back it again.
mysql -u root -pwhatever
UPDATE user SET Password=PASSWORD('') WHERE User='root' AND Host='%';
Install your program
UPDATE user SET Password=PASSWORD('whatever') WHERE User='root' AND Host='%';
Once it has installed there should be a configuration file somewhere with the login details.

share|improve this answer
    
After reading the bug report on launchpad I believe this can be a good solution in some cases. –  mit Sep 12 '10 at 11:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.