Chinaunix首页 | 论坛 | 博客
  • 博客访问: 190151
  • 博文数量: 28
  • 博客积分: 1490
  • 博客等级: 上尉
  • 技术积分: 310
  • 用 户 组: 普通用户
  • 注册时间: 2006-10-17 10:01
文章分类
文章存档

2012年(3)

2011年(2)

2008年(2)

2007年(7)

2006年(14)

我的朋友

分类: LINUX

2007-12-16 16:45:42

本文链接: http://blog.chinaunix.net/u/25081/showart_443606.html  转载请保持

在 gentoo 上安装了 mysql, 但运行时总是的得到这个错误信息:

Access denied for user 'root'@'localhost'


可以这样解决:

# /etc/init.d/mysql stop



# mysqld_safe --user=mysql --skip-grant-tables --skip-networking &


# mysql -u root mysql
mysql> UPDATE user SET Password=PASSWORD('yournewpasswd') where USER='root';
mysql> FLUSH PRIVILEGES;
mysql> quit

# /etc/init.d/mysql restart


搞定。

测试一下:

$ mysqladmin -uroot -pmypasswd ping
mysqld is alive


运行:


$ mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.44-log Gentoo Linux mysql-5.0.44

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql>

阅读(1191) | 评论(1) | 转发(0) |
给主人留下些什么吧!~~