在 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             

編輯:在閱讀了 Launchpad 上的錯誤報告後,我決定使用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;

@詹姆斯勞裡:我強烈建議不要直接向命令提供密碼,僅使用 -p 會提示您輸入密碼,這會阻止它被記錄到您的 shell 歷史記錄中,請參閱 5.3.2.2。最終用戶密碼安全指南

@詹姆斯勞裡:僅指定對本機的存取可以提高安全性。在你的例子中你使用'%'這將使偏僻的無需密碼即可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='%';
安裝完成後,應該會在某處出現一個包含登入詳細資訊的設定檔。

相關內容