Ruby on rails rails服务器(4.0.0)无法启动-错误:LoadError:8 lib/mysql2.rb:8:in`require';:libmysqlclient.so.18
我无法启动rails服务器。错误显示:Ruby on rails rails服务器(4.0.0)无法启动-错误:LoadError:8 lib/mysql2.rb:8:in`require';:libmysqlclient.so.18,ruby-on-rails,ruby,ruby-on-rails-4,Ruby On Rails,Ruby,Ruby On Rails 4,我无法启动rails服务器。错误显示: $ rails server /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2a.rb:8:in `require': libmysqlclient.so.18: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/li
$ rails server
/usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2a.rb:8:in `require': libmysqlclient.so.18: cannot open shared object file: No such file or directory - /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so (LoadError)
from /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2.rb:8:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
from /home/marslo/Study/Codes/Ruby/RailsBegin/config/application.rb:7:in `<top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:76:in `require'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:76:in `block in <top (required)>'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:73:in `tap'
from /usr/local/lib/ruby/gems/1.9.1/gems/railties-4.0.0/lib/rails/commands.rb:73:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
我已经从源代码安装了mysql。安装地点:
$ whereis mysql
mysql: /usr/local/mysql
我试着用gem用安装mysql2——用mysql-config
,一切正常:
$ sudo gem install mysql2 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.13
1 gem installed
Installing ri documentation for mysql2-0.3.13...
Installing RDoc documentation for mysql2-0.3.13...
这里是我的数据库.yml:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
以下是我的数据库:
mysql> SHOW DATABASES;
+------------------------+
| Database |
+------------------------+
| information_schema |
| RailsBegin_development |
| mysql |
| performance_schema |
| test |
+------------------------+
5 rows in set (0.00 sec)
这里是我的捆绑包安装:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
我不知道它怎么了。大家都能帮我吗?提前谢谢
============
更新1
我已卸载mysql2并重新安装为0.3.11:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
并更新Gemfile:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
和捆绑安装再次安装,但仍将安装0.3.13:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
此处宝石列表:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
顺便说一下,mysql(通过源代码安装)的所有者是mysql:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
但是,ruby的所有者是root
这是因为权限问题吗
====================
更新2
安装mysql2版本:0.3.11,使用--platform=ruby:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
mysql变量可以通过以下方式找到:
$ mysqladmin variables
并且,安装NodeJS:
$ ls -al /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
-rwxr-xr-x 1 root root 131K Oct 7 00:31 /usr/local/lib/ruby/gems/1.9.1/gems/mysql2-0.3.13/lib/mysql2/mysql2.so
development:
adapter: mysql2
encoding: utf8
database: RailsBegin_development
pool: 5
username: root
password: passwd
host: localhost
socket: /tmp/mysql.sock
$ bundle install
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Using mysql2 (0.3.13)
Using bundler (1.3.5)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ sudo gem install mysql2 -v 0.3.11 -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions. This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Installing ri documentation for mysql2-0.3.11...
Installing RDoc documentation for mysql2-0.3.11...
gem 'mysql2', '~> 0.3.11'
$ bundle install
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.0)
Using i18n (0.6.5)
Using minitest (4.7.5)
Using multi_json (1.8.1)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.37)
Using activesupport (4.0.0)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.0)
Using mime-types (1.25)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.0)
Using activemodel (4.0.0)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.0)
Using activerecord (4.0.0)
Using bundler (1.3.5)
Using coffee-script-source (1.6.3)
Using execjs (2.0.2)
Using coffee-script (2.2.0)
Using thor (0.18.1)
Using railties (4.0.0)
Using coffee-rails (4.0.0)
Using hike (1.2.3)
Using jbuilder (1.5.1)
Using jquery-rails (3.0.4)
Using json (1.8.0)
Installing mysql2 (0.3.13)
Using tilt (1.4.1)
Using sprockets (2.10.0)
Using sprockets-rails (2.0.0)
Using rails (4.0.0)
Using rdoc (3.12.2)
Using sass (3.2.12)
Using sass-rails (4.0.0)
Using sdoc (0.3.20)
Using turbolinks (1.3.0)
Using uglifier (2.2.1)
Your bundle is complete!
Use `bundle show [gemname]` to see where a bundled gem is installed.
$ gem list | grep mysql2
mysql2 (0.3.13, 0.3.11)
$ ls -al
total 160K
-rw-r--r-- 1 mysql mysql 18K Sep 10 15:38 COPYING
-rw-r--r-- 1 mysql mysql 2.5K Sep 10 15:38 README
-rw-r--r-- 1 mysql mysql 87K Sep 10 15:38 INSTALL-BINARY
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:51 docs/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 include/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:51 lib/
drwxr-xr-x 10 mysql mysql 4.0K Oct 1 23:52 mysql-test/
drwxr-xr-x 28 mysql mysql 4.0K Oct 1 23:52 share/
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:52 scripts/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 sql-bench/
drwxr-xr-x 4 mysql mysql 4.0K Oct 1 23:52 man/
drwxr-xr-x 3 mysql mysql 4.0K Oct 1 23:52 support-files/
-rw-r--r-- 1 mysql mysql 943 Oct 1 23:55 my.cnf
drwxr-xr-x 2 mysql mysql 4.0K Oct 1 23:57 bin/
drwxr-xr-x 6 mysql mysql 4.0K Oct 7 01:04 data/
$ sudo gem uninstall mysql2
$ sudo gem install mysql2 -v 0.3.11 --platform=ruby -- --with-mysql-config=/usr/local/mysql/bin/mysql_config --with-mysql-lib=/usr/local/mysql/lib --with-mysql-bin=/usr/local/mysql/bin
$ rm -rf Gemfile.lock
$ bundle install
$ sudo apt-get install nodejs
而且,它会起作用的
$ rails server
=> Booting WEBrick
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2013-10-07 21:08:06] INFO WEBrick 1.3.1
[2013-10-07 21:08:06] INFO ruby 1.9.3 (2013-06-27) [i686-linux]
[2013-10-07 21:08:06] INFO WEBrick::HTTPServer#start: pid=3676 port=3000
不要忘记启动mysql服务器:
$ sudo service mysql start
====================
更新3
CentOS的NodeJS安装:
$ sudo yum groupinstall 'Development Tools'
$ mkdir nodjs && cd $_
$ wget http://nodejs.org/dist/node-latest.tar.gz
--2013-10-12 16:01:53-- http://nodejs.org/dist/node-latest.tar.gz
Resolving nodejs.org... 165.225.133.150
Connecting to nodejs.org|165.225.133.150|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 13633041 (13M) [application/octet-stream]
Saving to: “node-latest.tar.gz”
100%[============================================================================>] 13,633,041 513K/s in 36s
2013-10-12 16:02:31 (375 KB/s) - “node-latest.tar.gz” saved [13633041/13633041]
$ tar xzf node-latest.tar.gz
$ cd node-v0.10.20/
$ ./configure
$ make
$ sudo make install
===================
注
- 这与权限问题无关
- 如果在Gemfile中更新了任何内容,请在运行捆绑安装之前先删除Gemfile.lock
gem'mysql2','~>0.3.11'
并再次尝试绑定。将此添加到GemFilegem'mysql2','~>0.3.11'
并再次尝试绑定。我的系统:-Windows 7 64位,MySQL 5.6,Ruby 1.9.3,Rails 4.0.4
执行以下步骤在rails中安装mysql2-
享受 我在MySQL更新后遇到了这个问题。最后,修复它所需的步骤是:
gem uninstall mysql2
apt-get install libmysqlclient-dev
bundle install
…此时已安装更新后的mysql2 gem,rails能够顺利启动。在MySQL更新后,我遇到了这个问题。最后,修复它所需的步骤是:
gem uninstall mysql2
apt-get install libmysqlclient-dev
bundle install
…此时已安装更新的mysql2 gem,rails可以毫无问题地启动。安装
mysql2
asmarslo
,而不是root
。ruby的lib已安装在/usr/local/lib/ruby/。我无法通过marslo
安装gems。顺便说一句,mysql的所有者是mysql
这里关于在没有sudo
的情况下安装mysql2的错误是:$gem安装mysql2--with mysql config=/usr/local/mysql/bin/mysql\u config--with mysql lib=/usr/local/mysql/bin获取:mysql2-0.3.13.gem(100%)错误:执行gem时。。。(Gem::FilePermissionError)您没有写入/usr/local/lib/ruby/gems/1.9.1目录的权限。
Installmysql2
asmarslo
,而不是root
。ruby的lib已安装在/usr/local/lib/ruby/。我无法通过marslo
安装gems。顺便说一句,mysql的所有者是mysql
这里关于在没有sudo
的情况下安装mysql2的错误是:$gem安装mysql2--with mysql config=/usr/local/mysql/bin/mysql\u config--with mysql lib=/usr/local/mysql/bin获取:mysql2-0.3.13.gem(100%)错误:执行gem时。。。(Gem::FilePermissionError)您没有写入/usr/local/lib/ruby/gems/1.9.1目录的权限。
只是查看了他的gemfile,但他的bundle输出中没有mysql2 Gem解释了为什么:pHi@David,我有mysql2:使用mysql2(0.3.13)
我已经更新了gemfile,但是mysql2仍然作为0.3.13安装。这是为什么?更改gemfile.lock或者删除gemfile.lock
并重新安装捆绑包。查看他的gemfile,他在捆绑包输出中没有mysql2 gem解释了原因:pHi@David,我有mysql2:使用mysql2(0.3.13)
我已经更新了gemfile,但是mysql2仍然作为0.3.13安装。为什么?更改gemfile.lock或删除gemfile.lock
,然后重新进行捆绑安装