简体   繁体   English

RoR3和MySQL错误:dyld:找不到符号:_mysql_init

[英]RoR3 and MySQL error: dyld: Symbol not found: _mysql_init

I am troubleshooting a problem with MySQL for my Ruby on Rails 3.0.5 application, Mac OS X 10.6. 我正在为我的Ruby on Rails 3.0.5应用程序Mac OS X 10.6解决MySQL问题。

I installed MySQL version 5.1 and I am getting this error: 我安装了MySQL 5.1版,我收到了这个错误:

dyld: lazy symbol binding failed: Symbol not found: _mysql_init
  Referenced from: /Users/manny/.gem/ruby/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
  Expected in: flat namespace

dyld: Symbol not found: _mysql_init
  Referenced from: /Users/manny/.gem/ruby/1.8/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle
  Expected in: flat namespace

Trace/BPT trap

I tried to install MySQL v5.5, but the error still occurs. 我试图安装MySQL v5.5,但错误仍然存​​在。 I installed MySQL from a .dmg. 我从.dmg安装了MySQL。

You don't need to remove MySQL and reinstall it, I did just with the following commands. 您不需要删除MySQL并重新安装它,我只使用以下命令。 It's very simple to do from your terminal and will solve your issues: 从终端进行操作非常简单,可以解决您的问题:

rvmsudo ARCHFLAGS="-arch x86_64" gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-opt-lib=/usr/local/mysql/lib 

I hope this might help you to solve the issues. 我希望这可以帮助您解决问题。

I tried numerous solutions found on the net. 我在网上尝试了很多解决方案。 Finally I decided to do it another way. 最后我决定以另一种方式做到这一点。 Reason for this is that most solution come with fixes for binding problems, that can be related back to troubles during the installation. 原因是大多数解决方案都带有绑定问题的修复程序,这可以解决安装过程中的问题。 Just a matter of authorization. 只是授权问题。

First removed the DBI and DBD / DBD::mysql files and folders from the Perl libraries folder in: 首先从Perl库文件夹中删除DBI和DBD / DBD :: mysql文件和文件夹:

/Library/Perl/5.16/darwin-thread-multi-2level

After that I started clan via a sudo 在那之后,我通过sudo开始战队

sudo cpan

In there I installed first DBI and after that DBD::mysql 在那里我安装了第一个DBI,然后安装了DBD :: mysql

install DBI
install DBD::mysql

And everything finally worked! 一切都终于奏效了! Hope this helps, someone. 希望这有帮助,有人。 A simple solution. 简单的解决方案。 It did cost me 2 days to debug and figure out. 它花了我2天的时间来调试和弄清楚。

Give the following a go... 给下面一个...

# Use mysqldump to backup your databases to text files!
# Stop the database server
sudo rm /usr/local/mysql
sudo rm -rf /usr/local/mysql*
sudo rm -rf /Library/StartupItems/MySQLCOM
sudo rm -rf /Library/PreferencePanes/My*
edit /etc/hostconfig and remove the line MYSQLCOM=-YES-
rm -rf ~/Library/PreferencePanes/My*
sudo rm -rf /Library/Receipts/mysql*
sudo rm -rf /Library/Receipts/MySQL*

Then... 然后...

# Install Homebrew if you have not got it.
brew install mysql
export ARCHFLAGS="-arch i386 -arch x86_64" gem install mysql -- --with-mysql dir=/usr/local \ --with-mysql-config=/usr/local/bin/mysql_config

That's assuming your homebrew prefix is /usr/local 假设你的自制前缀是/ usr / local

Otherwise you could always download the required MySQL Version, install and run the following... 否则你总是可以下载所需的MySQL版本,安装并运行以下内容......

env ARCHFLAGS="-arch x86_64" gem install --no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

Be sure to have your paths set in you bash and dont go about mysql2 0.2.7 with Rails. 一定要在你的bash中设置你的路径,不要使用Rails来使用mysql2 0.2.7。

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

相关问题 从node.js应用程序连接到mysql,错误:“ dyld:惰性符号绑定失败:找不到符号:_mysql_init” - Connect to mysql from node.js app, error: “dyld: lazy symbol binding failed: Symbol not found: _mysql_init” swig mysql:undefined symbol:mysql_init' - swig mysql: undefined symbol: mysql_init' Perl无法编译,找不到_mysql_init的懒惰符号绑定错误 - perl cannot compile with error of lazy symbol binding not found for _mysql_init 使用 DataMapper 时找不到 _mysql_init - _mysql_init not found when using DataMapper Redmine安装:Mysql gem说未定义符号:mysql_init - Redmine installation: Mysql gem say undefined symbol: mysql_init perl:符号查找错误:/usr/local/lib/perl/5.10.1/auto/DBD/mysql/mysql.so:未定义符号:mysql_init - perl: symbol lookup error: /usr/local/lib/perl/5.10.1/auto/DBD/mysql/mysql.so: undefined symbol: mysql_init 带有C ++错误的Mysql:对mysql_init的未定义引用 - Mysql with C++ error: undefined reference to mysql_init mysql_init()始终返回null - mysql_init() always return null mysql_init(NULL)分段错误 - mysql_init(NULL) segmentation fault 如何在C ++中的mysql_init期间解决mysql错误“内存不足”? - How to resolve the mysql error “insufficient memory” during mysql_init in c++?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM