[英]Error while installing mysql database for new ruby app
I am a total newbie, trying to setup all the components needed to be learn RoR but while installing mysql I am getting this message in the terminal: An error occurred while installing mysql2 (0.4.5), and Bundler cannot continue. 我是一个新手,尝试设置学习RoR所需的所有组件,但是在安装mysql时,我在终端中收到此消息:安装mysql2(0.4.5)时发生错误,并且Bundler无法继续。 Make sure that gem install mysql2 -v '0.4.5'
succeeds before bundling. 捆绑之前,请确保gem install mysql2 -v '0.4.5'
成功。 run bundle exec spring binstub --all bundler: command not found: spring Install missing gem executables with `bundle install 运行bundle exec spring binstub --all bundler:找不到命令:spring使用`bundle install安装缺少的gem可执行文件
Anyone know what should I do? 有人知道我该怎么办吗? Thanks 谢谢
You need to install mysql2 on your system before you can install the gem. 您需要先在系统上安装mysql2,然后才能安装gem。 On OSX you can do this via homebrew. 在OSX上,您可以通过自制程序执行此操作。
To install homebrew: 要安装自制软件:
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
To make sure homebrew is properly installed: 为了确保正确安装自制软件:
brew doctor
To install mysql: 要安装mysql:
brew install mysql
Then try your gem installation again and it should work: 然后再次尝试安装gem,它应该可以正常工作:
gem install mysql2 -v '0.4.5'
You need to install dependent libraries mysql-client
and libmysqlclient-dev
Command for Ubuntu machine 您需要为Ubuntu计算机安装依赖库mysql-client
和libmysqlclient-dev
命令
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
Just to make sure, you might also want to try removing your Gemfile.lock and then re-running bundle install once all dependent libraries get installed. 为了确保安全,您可能还想尝试删除Gemfile.lock,然后在安装完所有依赖库后重新运行捆绑软件安装。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.