如何修改 MySQL 密码以便可以 rake db: create on Rails?
我已经非常努力了。
当我 db:rake create 时,我得到以下信息: 用户“root”@“localhost”的访问被拒绝(使用密码:NO)。 请提供您的mysql安装的root密码 > 耙子中止!
没有设置密码。我在 stackoverflow 和 google 上搜索了一整天。 我什至为其设置了密码并尝试过。
是的,我去过 http: //dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix
但是当我按照说明重置密码时,终端和我自己都无法找到.pid 文件!
我尝试将 mysqld_safe 与 --skip-grant-tables 选项一起使用,结果是:
110821 23:32:22 mysqld_safe Starting mysqld daemon with Databases from /usr/local/var/mysql rm: /tmp/mysql.sock: 权限被拒绝 110821 23:32:24 mysqld_safe mysqld 来自 pid 文件 /usr/local/var/mysql/Tony-Ngs-MacBook-Air.local.pid 结束
I've very much so tried it all.
when I db:rake create, I get the following:
Access denied for user 'root'@'localhost' (using password: NO).
Please provide the root password for your mysql installation
>
rake aborted!
There is no password set. And I've searched all day on stackoverflow and on google.
I've even set a password for it and tried that out.
Yes, I've been to http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html#resetting-permissions-unix
But when I followed the instructions to reset the password, terminal and myself are unable to locate the .pid file!
I've tried using the mysqld_safe with --skip-grant-tables option and wound up with this:
110821 23:32:22 mysqld_safe Starting mysqld daemon with databases from /usr/local/var/mysql
rm: /tmp/mysql.sock: Permission denied
110821 23:32:24 mysqld_safe mysqld from pid file /usr/local/var/mysql/Tony-Ngs-MacBook-Air.local.pid ended
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我相信您只需要在 database.yml 文件中添加密码即可。这是当连接到 mysql 的客户端未指定密码时显示的错误,而不是服务器的配置问题(尽管在措辞上确实是这样)。
如果您需要在 MySQL 中设置密码,可以使用 grant 选项来完成:
I believe you just need to add the password in your database.yml file. That's an error that's displayed when the client connecting to mysql didn't specify a password, not a configuration issue with the server (although it does appear that way with the phrasing).
If you need to set your password in MySQL, you do it with a grant option: