ERROR: Error installing mysql2: ERROR: Failed to build gem native extension [@Ubuntu 15.04]
参考文章:
https://blog.csdn.net/a60919820/article/details/101847890
安装mysql
参考:https://www.cnblogs.com/haima/p/15504670.html
再安装libmysqlclient-dev
和 mysql2
sudo cp /etc/apt/sources.list /etc/apt/sources.listbak #备份源
sudo vim /etc/apt/sources.list # 添加下面的源
deb [by-hash=force] https://mirrors.huaweicloud.com/deepin/ apricot main contrib non-free
sudo apt-get update #更新源
sudo apt-get upgrade 不用执行
安装mysql
参考下面的链接下载 mysql-apt-config_0.8.20-1_all.deb
https://www.ywnz.com/linuxysjk/9249.html
选择安装mysql87或者mysql5.7的源
sudo dpkg -i ./mysql-apt-config_0.8.20-1_all.deb
sudo apt-get update #更新源
sudo apt-get install mysql-server #安装mysql
sudo service mysql status #查看MySQL是否安装成功
sudo apt-get install libmysqlclient-dev #安装mysql客户端依赖
cd 进入项目的根目录里
gem install mysql2 -v '0.4.10' --source 'https://gems.ruby-china.com/'
bundle install #安装项目的依赖
rails s #启动项目
[Haima的博客]
http://www.cnblogs.com/haima/