Rails生成项目时可能没有JS环境报错:Could not find a JavaScript runtime
sudo apt-get install nodejs libmysql-ruby libmysqlclient-dev
1、编辑Gemfile文件加上:
gem 'mysql2', '0.3.13'
2、修改config/database.yml文件 ,测试的数据库也要改
development: adapter: mysql2 encoding: utf8 database: blog_development pool: 5 username: root password: socket: /tmp/mysql.sock
其中:socket: /tmp/mysql.sock,可能不一样,可以通过:$mysqladmin variables | grep socket 查看到
| socket | /var/run/mysqld/mysqld.sock
3、安装Mysql
sudo apt-get install mysql-server
4、运行:
$ rake db:create
参考资料: