在 ubuntu 08.04 上安装 mtop

在 ubuntu 08.04 上安装 mtop

我正在 ubuntu 8.04 上安装 mtop,Mysql 正在运行。

在安装过程中会出现一条消息:

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

(见下文)

我怀疑我必须以某种方式允许 unix 用户 root 访问 mysql 帐户 root?

正确的步骤是什么?

$ 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             

编辑:在阅读了启动板上的错误报告后,我决定使用mytop旧版 ubuntu 中的类似工具。

答案1

首先使用你的 root 帐户打开启动 mysql 客户端:

mysql -u root -p

只需删除 root 密码即可本地主机并刷新权限:

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

现在安装mtop,例如:

sudo aptitude install mtop

安装完成后将密码设置回旧密码:

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

@JamesLawrie:我强烈建议不要直接向命令提供密码,仅使用 -p 将提示您输入密码,这样可以防止密码被记录到 shell 历史记录中,请参阅 5.3.2.2。最终用户密码安全指南

@JamesLawrie:仅指定对本地主机的访问可提高安全性。在您的示例中,您使用‘%’这将使偏僻的无需密码即可进行 root 访问!

但最终修复这个错误可能是最好的方法:https://bugs.launchpad.net/ubuntu/+source/mtop/+bug/77980

答案2

这个错误描述了一些解决方法甚至替代(PPA)包:

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

答案3

解决这个问题的一个糟糕的方法是先删除 localhost 的 MySQL root 密码,然后再重新添加。
mysql -u root -pwhatever
UPDATE user SET Password=PASSWORD('') WHERE User='root' AND Host='%';
安装你的程序
UPDATE user SET Password=PASSWORD('whatever') WHERE User='root' AND Host='%';
一旦安装完成,应该有一个包含登录详细信息的配置文件。

相关内容