
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
Launchpad のバグレポートを読んだ後、古い Ubuntu エディションの同様のツールを使用することにしました。
答え1
まず、ルート アカウントを使用して MySQL クライアントを起動します。
mysql -u root -p
ルートパスワードを削除するにはローカルホスト権限をフラッシュします:
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 のみを使用するとパスワードの入力が求められ、シェルの履歴に記録されなくなります。5.3.2.2 を参照してください。パスワードセキュリティに関するエンドユーザーガイドライン
ジェームズ・ローリー: ローカルホストへのアクセスのみを指定すると、セキュリティ面が向上します。例では、'%'これによりリモートパスワードなしでルートアクセス!
最終的には、このバグを修正するのがおそらく最善のアプローチでしょう:https://bugs.launchpad.net/ubuntu/+source/mtop/+bug/77980
答え2
このバグでは、いくつかの回避策と代替 (PPA) パッケージについても説明しています。
答え3
これを修正する 1 つのハッキーで恐ろしい方法は、まず localhost の MySQL ルート パスワードを削除し、その後再度追加することです。
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='%';
インストールが完了すると、ログインの詳細を含む構成ファイルがどこかに作成されるはずです。