分类: 2011-05-24 15:34 2105人阅读 (0)
我的系统是ubuntu8.04,最近新装好的mysql在进入mysql工具时,总是有错误提示:
# mysql -uroot -pEnter password:ERROR 1045 (28000): Access denied for user 'root'@'localhost'(using password: NO)使用网上介绍的方法修改root用户的密码:# mysqladmin -uroot -p password 'newpassword'Enter password:mysqladmin: connect to server at 'localhost' failederror: 'Access denied for user 'root'@'localhost' (using password:YES)'现在终于被我找到了解决方法:切换到root用户,然后进入mysql 的bin目录后,
root@cps-desktop:/usr/local/mysql/bin# /etc/init.d/mysql stoproot@cps-desktop:/usr/local/mysql/bin# ./mysqld_safe --user=mysql --skip-grant-tables --skip-networking&root@cps-desktop:/usr/local/mysql/bin# ./mysql -u root mysqlmysql> UPDATE user SET Password=PASSWORD('newpassword') whereUSER='root';mysql> FLUSH PRIVILEGES;mysql> quit; 最后重启数据库:root@cps-desktop:/usr/local/mysql/bin# /etc/init.d/mysql restartroot@cps-desktop:/usr/local/mysql/bin# mysql -u root -pEnter password: <输入新设的密码newpassword>mysql>