ubuntu7.10下使用root登录mysql出现错误的解决
ubuntu7.10下使用root登录mysql出现错误的解决
有空先后安装了Ubuntu7.10的服务器版和桌面版。服务器版,直接配置了LAMP服务器,桌面版,我通过新立得软件管理器-》编辑-》使用任务分组标记软件包。选中LAMP安装。
在bash里,使用root登录mysql;# mysql -u root -p 返回出现如下错误,ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: yes)。
怎么办?
解决方法如下:
1、打开/etc/mysql/debian.cnf文件,有桌面可以用gedit,服务器用vim,记录下文件中[client]节提供的用户名和密码:
mysql -u debian-sys-maint -p
Enter password: <输入[client]节的密码>
mysql>use mysql;
mysql> UPDATE user SET Password=PASSWORD('newpwd') where User=’root’;
mysql>quit
'newpwd'就是root新的密码。
再次用登录root,就行了。
评论暂时关闭