gem install mysql2 安装相关问题

来源:转载

1.情况1: "bundle install" command or "gem install mysql2" it gives me following error "Error installing mysql2: ERROR: Failed to build gem native extension."

解决方案:  sudo apt-get install libmysql-ruby libmysqlclient-dev

gem install mysql2

2.情况2: 安装mysql时候 改变了安装目录,

 checking for mysql_query() in -lmysqlclient... no > checking for main() in -lm... yes > checking for mysql_query() in -lmysqlclient... no > checking for main() in -lz... yes > checking for mysql_query() in -lmysqlclient... no > checking for main() in -lsocket... no > checking for mysql_query() in -lmysqlclient... no > checking for main() in -lnsl... yes > checking for mysql_query() in -lmysqlclient... no > extconf.rb failed > Could not create Makefile due to some reason, probably lack of > necessary libraries and/or headers. Check the mkmf.log file for more > details. You may need configuration options. 

解决方案:sudo gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

http://zool.it/posts/gem-install-mysql2-error

3. 以上两种组合

分享给朋友:
------分隔线----------------------------
您可能感兴趣的文章:
随机阅读: