When creating ruby ​​db lazy character failure

I am trying to install ruby ​​on rails and now everything is installed, but when I try to create a database with rake db:create , I get a strange error:

dyld: lazy symbol binding failed: Symbol not found: _mysql_get_client_info References: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle Expected in: flat namespace

dyld: Symbol not found: _mysql_get_client_info References: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle Expected in: flat namespace

Trace / BPT Trap: 5

I am working on the latest update of the osx mountain lion. Does anyone have the right solution for me?

+4
source share
7 answers

You can try this.

 sudo gem install mysql2 β€” –with-mysql-config=/usr/local/mysql/bin/mysql_config 

Be sure to change the mysql configuration path to your location.

You can determine this with the following command.

 locate mysql_config 

Use the path above.

+4
source

There are numerous questions about this and at least so many answers that work for a while, but not others. Having tried most of them, I noticed that the stone was 64 bits and the mysql installation was 32 bits.

To fix this:

  • install 64 bit mysql
  • configure symbolic links in / usr / local to point to the 64-bit version
  • set PATH and DYLD_LIBRARY_PATH to your profile to enable the correct versions
  • remove mysql2 stone
  • install the verb mysql2
  • Ruby is now playing fine with mysql!

I did not include the exact code, as it tends to change depending on your environment.

+2
source

The promise says that you linked the wrong version 32 to 64

In OSX you can see all versions on the installed mysql

 cd /usr/local/ 

and find the correct config in / usr / local / mysql -xxxx / bin / mysql_config

In my case, it was:

 gem uninstall mysql2 sudo gem install mysql2 -- --with-mysql-config=/usr/local/mysql-5.5.27-osx10.6-x86_64/bin/mysql_config 

As discussed here: https://www.ruby-forum.com/topic/1440086

+2
source

It was difficult for me with this ... I tried all the answers above, so I can not determine exactly which combination led to the correction. I already installed mysql and reinstalled it from the mysql site. Finally he started working after I followed him.

This is on Mavericks using rails 4 and brew installed

 brew install mysql 

I do not recommend this process. Just noting that it worked for me after hours of disappointment.

 ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist sudo gem uninstall mysql gem uninstall mysql2 gem install mysql gem install mysql2 
+1
source

You need to install the 64-bit MySql server. Remember to reinstall mysql gem.

0
source

For some reason, I had two versions of mysql (32 and 64 bit).

Ensure that the $ MYSQL environment variable (most likely found in ~ / .bash_profile or ~ / .profile) points to the 64-bit version.

Also make sure that you indicate the correct installation of mysql when you install the stone, as the other answers mentioned.

0
source

I had the same problem. mysql2 version was 0.4.9, downgraded to 0.4.5 and the problem was resolved.

0
source

All Articles