简体   繁体   English

的Ruby / Rails / MySQL的

[英]Ruby/Rails/Mysql

I am on leopard. 我在豹子上。 It comes with Ruby 1.8 & Sqlite3 pre-installed. 它预装了Ruby 1.8和Sqlite3。 I have updated ruby to 1.9.1 & added Mysql. 我已经将ruby更新为1.9.1并添加了Mysql。 Here's the problem. 这是问题所在。 I cannot get the path to correctly point to ruby 1.9.1. 我无法正确地指向Ruby 1.9.1。 I tried to update the sym-link to no avail. 我试图更新符号链接无济于事。 I am able to get into Mysql from the terminal but I cannot connect to the server through Ruby because Sqlite3 is the default. 我可以从终端进入Mysql,但是我不能通过Ruby连接到服务器,因为Sqlite3是默认的。 I changed the database in my apps config file but it still doesn't work. 我在我的应用程序配置文件中更改了数据库,但仍然无法正常工作。 Something is really screwing this up. 确实是在搞砸了。 I want to unistall every version of Ruby, Rails, All Gems, Mysql, Sqlite3, etc & roll all of what I want on my own. 我想取消所有版本的Ruby,Rails,All Gems,Mysql,Sqlite3等,并自行滚动所有我想要的东西。 Where can I find the commands through the command line to do this? 在哪里可以找到通过命令行执行的命令? Can I just send these files to the trash manually as I find them on /usr/local/....? 在/ usr / local / ....中找到文件时,是否可以手动将它们手动发送到回收站? I am really frustrated at this point! 在这一点上我真的很沮丧! please help. 请帮忙。

Re-installing those packages will still not guarantee that its going to work. 重新安装这些软件包仍不能保证其正常工作。 I would recommend go through the logs and see if you pick up some something obvious. 我建议您浏览日志,看看是否有明显的东西。 There are lots of debugging techniques available for a Rails app, for starters see here Rails应用程序有许多调试技术可用,对于初学者来说请参见此处

Here's a small ruby snippet to see if the connection to MySQL works fine, give it a try if you see the MySQL server version being printed on your terminal then you know the problem is somewhere else, do not forget to change the credentials. 这是一个小红宝石代码段,用于查看与MySQL的连接是否正常,如果尝试查看终端上是否打印了MySQL服务器版本,请尝试一下,然后您知道问题出在其他地方,不要忘记更改凭据。

   #!/usr/bin/ruby -w

   require "mysql"

   begin
   # connect to the MySQL server
   dbh = Mysql.real_connect("localhost", "testuser", "testpass", "test")
   # get server version string and display it
   puts "Server version: " + dbh.get_server_info
   rescue Mysql::Error => e
     puts "Error code: #{e.errno}"
     puts "Error message: #{e.error}"
     puts "Error SQLSTATE: #{e.sqlstate}" if e.respond_to?("sqlstate")
   ensure
   # disconnect from server
   dbh.close if dbh
 end

Also if possible please provide some more details about the environment you are using, like 另外,请尽可能提供有关您所使用的环境的更多详细信息,例如

Apache + Rails + Mongrel or Apache + Rails + Passenger etc Apache + Rails + Mongrel或Apache + Rails + Passenger等

a snippet of your app/config/database.yml etc 您的app / config / database.yml等的片段

If you are frustrated, take a break , relax, have a coffee :-) and then start over again....working in a frustrated state of mind is definitely not going to help solve problems. 如果您感到沮丧,请稍事休息,放松,喝咖啡:-),然后重新开始...。在沮丧的状态下工作绝对不会帮助解决问题。

HTH HTH

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM