[英]Installing MySQL and mysql gem on Snow Leopard
It´s really a hard job figuring out how to get MySQL and mysql gem up and running on Snow Leopard 10.6.2. 弄清楚如何在Snow Leopard 10.6.2上启动并运行MySQL和mysql gem,这确实是一项艰巨的工作。 I followed the instructions of various posts but was not successful yet:
我遵循了各种职位的指示,但尚未成功:
I build MySQL Version 5.1.39 from source and it installed successfully. 我从源代码构建MySQL版本5.1.39,并成功安装。 When trying to login using (mysql -u root -p) mysql returned the following error:
尝试使用(mysql -u root -p)登录时,mysql返回以下错误:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
that obviously meant that the MySQL Server (mysqld) was not running. 这显然意味着MySQL Server(mysqld)没有运行。
which mysql: /usr/local/mysql/bin/mysql
which ruby: ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9])
gem -v: 1.3.5
mysql: Server version: 5.1.39 MySQL Community Server (GPL)
After a lot of googling around, I found out that 经过大量的搜寻,我发现
this command can start mysqld: 这个命令可以启动mysqld:
sudo /usr/local/mysql/bin/mysqld_safe --user=mysql &
The Preference Pane MySQL Tool is probably broken in Mac OS X 10.5 and higher 在Mac OS X 10.5和更高版本中,“首选项窗格MySQL工具”可能已损坏
This command should install the mysql gem correctly on Snow Leopard: 此命令应在Snow Leopard上正确安装mysql gem:
sudo gem uninstall mysql sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
It ended up that I got the following error using something like rake db:create: 最后,我使用rake db:create之类的东西得到了以下错误:
dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
dyld: Symbol not found: _mysql_init
Referenced from: /opt/local/lib/ruby/gems/1.8/gems/mysql-2.8.1/lib/mysql_api.bundle
Expected in: flat namespace
This error led me to the following post: http://cho.hapgoods.com/wordpress/?p=158 , that basically tells me that the Ruby Version that came together with XCode 3.0 does not work in 64bit environments and a solution could be to install the 32bit versionof MySQL. 这个错误使我引至以下文章: http : //cho.hapgoods.com/wordpress/?p=158 ,基本上告诉我与XCode 3.0一起提供的Ruby版本在64位环境中不起作用,安装32位版本的MySQL。
Any suggestions, how to proceed? 有什么建议,如何进行?
While building from source is not necessarily a bad idea, even if the official distribution is built using a better compiler, using MacPorts ( http://www.macports.org/install.php ) to do it is probably a better idea than a self-built installation. 尽管从源代码构建不一定是一个坏主意,即使官方发行版是使用更好的编译器构建的,但是使用MacPorts( http://www.macports.org/install.php )进行构建可能比自建安装。
Although you can wrangle the OS X supplied Ruby and MySQL into shape, in my experience it's easier to work entirely within the MacPorts realm (/opt) and leave your original distribution unmolested. 尽管您可以纠结OS X提供的Ruby和MySQL,但以我的经验来看,完全在MacPorts领域(/ opt)中工作并保持原始发行版本更加容易。
A further advantage is you get a more up-to-date Ruby executable. 另一个优点是您可以获得更新的Ruby可执行文件。 10.6 ships with 1.8.7p72 where MacPorts provides 1.8.7p174, for instance.
10.6随附1.8.7p72,其中MacPorts提供了1.8.7p174。
Example: 例:
sudo port install mysql5
sudo port install mysql5-server
sudo port install rb-mysql
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.