我在ubuntu 8.04上安装mtop正在运行Mysql。
在安装过程中有一条消息:
Access denied for user 'root'@'localhost' (using password: NO)
(见下文)
我怀疑我不得不允许从Unix用户根访问MySQL帐户的根?
什么是正确的步骤?
$ 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
编辑:在阅读启动板上的bugreport后,我决定在旧的ubuntu版本中使用类似的工具mytop 。
首先使用你的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 :我强烈build议不要直接将密码提供给命令,只使用-p会提示input密码,这会阻止它被logging到shell历史logging中,请参阅5.3.2.2。 最终用户密码安全指南
@JamesLawrie :指定只访问本地主机提高了安全性。 在你的例子中,你使用'%' ,这将启用远程 root访问没有密码!
尽pipe最终修复这个bug可能是最好的方法: https : //bugs.launchpad.net/ubuntu/+source/mtop/+bug/77980
此错误描述了一些解决方法,甚至替代(PPA)包:
解决这个问题的一个可怕的办法是首先删除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='%';
一旦安装,应该有一个configuration文件的login细节的地方。