手机版
你好,游客 登录 注册 搜索
背景:
阅读新闻

gentoo下运行mysql提示Access denied for user 'root'@'localhost'错误的解决

[日期:2007-12-18] 来源:Linux公社  作者:Linux [字体:大 中 小]

在 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> 

linux
相关资讯       mysql  Gentoo 
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款