I am troubleshooting a problem with MySQL for my Ruby on Rails 3.0.5 application, Mac OS X 10.6.
I installed MySQL version 5.1 and I am getting this error:
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. I installed MySQL from a .dmg.
You don't need to remove MySQL and reinstall it, I did just with the following commands. 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:
/Library/Perl/5.16/darwin-thread-multi-2level
After that I started clan via a sudo
sudo cpan
In there I installed first DBI and after that 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.
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
Otherwise you could always download the required MySQL Version, install and run the following...
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.