[英]Rails Error - No Such File to Load — mysql
I've been fighting with a Rails install on my Mac for some time. 我一直在为Mac上的Rails安装而斗争。 The error I'm getting (in my development log) says:
我收到的错误(在我的开发日志中)说:
Status: 500 Internal Server Error no such file to load -- mysql
Here's some info: 这是一些信息:
mysqladmin -uroot create sampledb
) works fine. mysqladmin -uroot create sampledb
)可以正常工作。 I've googled this and can't find anything specific to this error. 我已经在Google上进行了搜索,但找不到与此错误相关的任何内容。 There are a few related results where the solutions relate to paths when installing the MySQL gem.
在安装MySQL gem时,有一些与结果相关的解决方案与路径相关的信息。 For example,
例如,
sudo env ARCHFLAGS="-arch i386" gem install mysql -- \
--with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib \
--with-mysql-include=/usr/local/mysql/include
Has anyone else experienced this issue or suggest a solution? 其他人是否遇到过此问题或建议解决方案?
Thanks for the response - the good news is, the problem is solved. 感谢您的答复-好消息是,问题已解决。
The bad news - I'm not entirely sure what fixed it. 坏消息-我不完全确定是什么原因解决了。 I can tell you this: it had something to do with the mysql gem install and all the flags pointing to lib, include and config.
我可以告诉你:这与mysql gem install和所有指向lib,include和config的标志有关。 There are probably a dozen different versions of the same command floating around out there for Mac OS X Leopard.
对于Mac OS X Leopard,该命令可能有十几种不同版本。
The odd thing was that ruby appeared to be connected to mysql on some level (it's ability to rake db for example) but broke when actually loading a page. 奇怪的是,ruby似乎在某种程度上已连接到mysql(例如,它具有耙入db的能力),但在实际加载页面时却损坏了。
The gem install string that ended up working was this: 最终可以工作的gem install字符串是这样的:
sudo env ARCHFLAGS="-arch i386" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
I'd love some clarification on the how's & why's of this. 我希望对此做些什么以及为什么做些澄清。 This worked for me, but doesn't include pointers to the app directory, the lib directory or the include directory.
这对我有用,但不包含指向应用程序目录,lib目录或包含目录的指针。
whereis ruby
whereis ruby
Double check if the mysql bin path is in your $PATH system environment variable. 仔细检查mysql bin路径是否在$ PATH系统环境变量中。 If you execute
如果执行
*echo $PATH*
there must be displayed something like 必须显示类似
*/usr/local/mysql/bin*
You can also type 您也可以输入
mysql and then the tab-key twice. mysql ,然后按两次tab键。 If if this doesn't bring up a list of mysql commands (like mysqladmin etc.) the mysql bin path is not set ccorrectly.
如果这不能显示mysql命令列表(如mysqladmin等),则说明mysql bin路径设置不正确。 You can set it by adding the correct directory to your bash profile file.
您可以通过将正确的目录添加到bash配置文件中来进行设置。
echo 'export PATH=/usr/local/mysql/bin:$PATH' >> ~/.bash_profile
Please verify up front if 请预先验证是否
*/usr/local/mysql/bin*
really contains the mysql commands on your Mac. 实际上包含Mac上的mysql命令。 Important: close and reopen the terminal window to make changes work.
重要:关闭并重新打开终端窗口以使更改生效。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.