I installed Ruby on Rails, MySQL Server 5.6, and the mysql2 gem on my Windows 7 computer. MySQL Server 5.6 runs on port 3000. My database.yml file is:
# MySQL2
# gem install mysql2
# Ensure the mysql2 gem is defined in your Gemfile
# gem 'mysql2'
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: demo1_development
pool: 5
username: root
password: root
host: 127.0.0.1
port: 3000
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: demo1_test
pool: 5
username: root
password: root
host: 127.0.0.1
port: 3000
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: demo1
pool: 5
username: root
password: root
host: 127.0.0.1
port: 3000
I ran "bundle install" with the following Gemfile:
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.2'
# Use mysql2 as the database for Active Record
gem 'mysql2'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
gem 'devise'
gem 'protected_attributes'
gem 'terminator'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I could run the "bundle install", "rake db:create" and "rake db:migrate" commands without any problems. I started the MySQL server and typed "rails s" in the command line. The result was the following: WARN TCPServer Error: Permission denied - bind (2) Exiting
I made sure to open port 3000 in Windows Firewall, and allow rails to communicate through the firewall.
Typing "rails s -p 80" works, and the web application works on localhost:80, but the fields won't work because MySQL Server will not run on port 80.
Am I missing something? How can I get the Rails server and web app to work?