Rails postgresql 数据库连接
我正在尝试为我的 Rails 应用程序使用 postgresql 数据库。
我按照此链接中提供的教程进行操作:
http://blog.crowdint.com/2010/10/27/working-with-postgresql-and-rails3.html
我使用此命令成功安装了 postgresql:
sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev libpgsql-ruby libgda-4.0-postgres libpq-dev
当我到达创建用户的行时,我输入了此命令:
sudo -u postgres psql template1
但是在我输入 root 的密码后,它给了我一个错误,说
env: -u: No such file or directory
知道为什么错误弹出?
I am trying to use a postgresql database for my rails app.
I followed the tutorials provided in this link:
http://blog.crowdint.com/2010/10/27/working-with-postgresql-and-rails3.html
I successfully installed postgresql with this command:
sudo apt-get install postgresql postgresql-client postgresql-contrib libpq-dev libpgsql-ruby libgda-4.0-postgres libpq-dev
When I reached the line to create a user I entered this command:
sudo -u postgres psql template1
But after I entered a password for root it gave me an error saying
env: -u: No such file or directory
Any idea why the error popped up?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来环境/路径可能对您的用户来说很混乱。我不确定您是否在 mac 或 linux/unix 上运行,但我在 Ubuntu 论坛上找到了一篇可能与您的问题相关的帖子:
sudo 坏了
我不确定别名 sudo (第 2 页回复)是否
是最好的永久解决方案,但它为他修复了它。我的 sudo 上没有这样的别名,所以我认为通过配置文件/导出命令有更好的解决方案,并且会邀请某人提供更好的答案。
希望这有帮助
It sounds like the environment/path may be messed up for your user. I'm not sure if you're running on mac or linux/unix but I found a post from the Ubuntu forums that may be related to your problem:
sudo is broken
I'm not sure if alias'ing sudo (page 2 reply)
is the best permanent solution but it fixes it for him. I have no such alias on my sudo so I'm thinking there's a better solution via profile / export command and would invite someone to provide a better answer.
Hope this helps