首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >连接和安装mysql2时出错

连接和安装mysql2时出错
EN

Stack Overflow用户
提问于 2017-09-03 00:25:19
回答 1查看 430关注 0票数 0

我想从命令行安装并连接到mysql2我的操作系统是Ubuntu,我添加了具有完全权限的用户,但我仍然收到以下消息:错误:当执行gem...(Errno::EACCES)权限被拒绝@ rb_sysopen - /var/lib/gems/2.3.0/gems/mysql2-0.4.9/CHANGELOG.md

代码语言:javascript
复制
:~/Desktop/simple_cms$ gem install mysql2 -v '0.4.9'
Building native extensions.  This could take a while...
/usr/lib/ruby/2.3.0/rubygems/ext/builder.rb:76: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/mysql2-0.4.9/ext/mysql2
/usr/bin/ruby2.3 -r ./siteconf20170903-6674-101jhbn.rb extconf.rb
checking for rb_absint_size()... yes
checking for rb_absint_singlebit_p()... yes
checking for ruby/thread.h... yes
checking for rb_thread_call_without_gvl() in ruby/thread.h... yes
checking for rb_thread_blocking_region()... no
checking for rb_wait_for_single_fd()... yes
checking for rb_hash_dup()... yes
checking for rb_intern3()... yes
checking for rb_big_cmp()... yes
checking for mysql_query() in -lmysqlclient... no
-----
mysql client is missing. You may need to 'apt-get install libmysqlclient-dev' or 'yum install mysql-devel', and try again.
-----
*** 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.

Provided configuration options:
    --with-opt-dir
    --without-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/usr/bin/$(RUBY_BASE_NAME)2.3
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /var/lib/gems/2.3.0/gems/mysql2-0.4.9 for inspection.
Results logged to /var/lib/gems/2.3.0/extensions/x86_64-linux/2.3.0/mysql2-0.4.9/gem_make.out
EN

回答 1

Stack Overflow用户

发布于 2018-06-22 05:06:04

如果您使用的是mac,并通过自制软件安装了mysql,请尝试以下命令:

brew link mysql

之后,再次尝试安装gem:

gem install mysql2

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46015845

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档