使用 mysql 数据库创建新应用 rails 时出错
error while creating new app rails with mysql db
大家好,我是 rails 的新手,我安装了所有东西 ruby rails mysql 一切都做得很好很健康,当我尝试创建一个新的应用程序 'rails new blog' 例如,一切都做得很好,但每当我添加“-d mysql”时,它就会卡住并给出一个错误,知道一切都已安装好
Aikers-MBP:~ Aiker$ brew install mysql
警告:mysql-5.7.16 已经安装
艾克斯-MBP:~艾克斯$
这里我尝试安装
安装 mysql2 (0.4.5) 时发生错误,Bundler 无法继续。
确保 gem install mysql2 -v '0.4.5'
在捆绑之前成功。
Aikers-MBP:kar Aiker$ rake db 创建
在您的 Gemfile 中列出的或本机可用的任何 gem 源中找不到 gem 'rails (= 4.2.6)'。
运行 bundle install
安装缺少的 gem。
Aikers-MBP:kar Aiker$ gem install mysql2 -v '0.4.5'
构建本机扩展。这可能需要一段时间...
错误:安装 mysql2 时出错:
错误:无法构建 gem 本机扩展。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2
/Users/Aiker/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161121-68854-12pc3sf.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
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql/5.7.16/lib
-----
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/Aiker/Desktop/blog/vendor/bundle/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/mkmf.log
current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean
current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5 for inspection.
Results logged to /Users/Aiker/Desktop/blog/vendor/bundle/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/gem_make.out
An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.5'` succeeds before bundling.
您的系统无法找到 OpenSSL 中存在的 lssl
库。要解决此问题,您需要 运行:
brew install openssl
在此之后尝试安装 mysql2
gem。如果仍然失败,那么您可能需要通过 运行ning:
重新安装 Xcode 命令行工具
xcode-select --install
希望这能解决您的安装问题。 :)
大家好,我是 rails 的新手,我安装了所有东西 ruby rails mysql 一切都做得很好很健康,当我尝试创建一个新的应用程序 'rails new blog' 例如,一切都做得很好,但每当我添加“-d mysql”时,它就会卡住并给出一个错误,知道一切都已安装好
Aikers-MBP:~ Aiker$ brew install mysql 警告:mysql-5.7.16 已经安装 艾克斯-MBP:~艾克斯$
这里我尝试安装
安装 mysql2 (0.4.5) 时发生错误,Bundler 无法继续。
确保 gem install mysql2 -v '0.4.5'
在捆绑之前成功。
Aikers-MBP:kar Aiker$ rake db 创建
在您的 Gemfile 中列出的或本机可用的任何 gem 源中找不到 gem 'rails (= 4.2.6)'。
运行 bundle install
安装缺少的 gem。
Aikers-MBP:kar Aiker$ gem install mysql2 -v '0.4.5'
构建本机扩展。这可能需要一段时间...
错误:安装 mysql2 时出错:
错误:无法构建 gem 本机扩展。
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2
/Users/Aiker/.rbenv/versions/2.3.1/bin/ruby -r ./siteconf20161121-68854-12pc3sf.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
-----
Using mysql_config at /usr/local/bin/mysql_config
-----
checking for mysql.h... yes
checking for SSL_MODE_DISABLED in mysql.h... yes
checking for SSL_MODE_PREFERRED in mysql.h... yes
checking for SSL_MODE_REQUIRED in mysql.h... yes
checking for SSL_MODE_VERIFY_CA in mysql.h... yes
checking for SSL_MODE_VERIFY_IDENTITY in mysql.h... yes
checking for errmsg.h... yes
checking for mysqld_error.h... yes
-----
Don't know how to set rpath on your system, if MySQL libraries are not in path mysql2 may not load
-----
-----
Setting libpath to /usr/local/Cellar/mysql/5.7.16/lib
-----
creating Makefile
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/Aiker/Desktop/blog/vendor/bundle/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/mkmf.log
current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR=" clean
current directory: /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5/ext/mysql2
make "DESTDIR="
compiling client.c
compiling infile.c
compiling mysql2_ext.c
compiling result.c
compiling statement.c
linking shared-object mysql2/mysql2.bundle
ld: library not found for -lssl
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [mysql2.bundle] Error 1
make failed, exit code 2
Gem files will remain installed in /Users/Aiker/Desktop/blog/vendor/bundle/gems/mysql2-0.4.5 for inspection.
Results logged to /Users/Aiker/Desktop/blog/vendor/bundle/extensions/x86_64-darwin-16/2.3.0-static/mysql2-0.4.5/gem_make.out
An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.4.5'` succeeds before bundling.
您的系统无法找到 OpenSSL 中存在的 lssl
库。要解决此问题,您需要 运行:
brew install openssl
在此之后尝试安装 mysql2
gem。如果仍然失败,那么您可能需要通过 运行ning:
xcode-select --install
希望这能解决您的安装问题。 :)