Now, I'm new to RoR and MySQL, but I swear I've looked in every single nook and cranny to find a solution to this problem, and I have a feeling it's solution is going to be something either very simple, or no one will know what to do.
What I'm doing is following an example in a book, where I am supposed to issue the command
rake db:migrate
I have MySQL, with a created database called
myblog_dev
MySQL service IS running.
I CAN access it through the root with my password.
But every time I issue that rake command it tells me:
C:\Sites\myblog>rake db:migrate --trace ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Invoke rails_env (first_time) ** Execute rails_env ** Execute db:load_config [b]** Execute db:migrate rake aborted! Can't connect to MySQL server on 'localhost' (10061)[/b] C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l ib/mysql2/client.rb:44:in `connect' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/mysql2-0.3.11-x86-mingw32/l ib/mysql2/client.rb:44:in `initialize' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/mysql2_adapter.rb:16:in `new' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/mysql2_adapter.rb:16:in `mysql2_connection' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:277:in `new_connection ' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:287:in `checkout_new_c onnection' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:235:in `block (2 level s) in checkout' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:230:in `loop' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:230:in `block in check out' C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:229:in `checkout' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:95:in `connection' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_pool.rb:374:in `retrieve_conne ction' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_specification.rb:168:in `retri eve_connection' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/connection_adapters/abstract/connection_specification.rb:142:in `conne ction' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/migration.rb:646:in `initialize' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/migration.rb:554:in `new' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/migration.rb:554:in `up' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/migration.rb:535:in `migrate' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/activerecord-3.2.1/lib/acti ve_record/railties/databases.rake:153:in `block (2 levels) in <top (required)>' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:205:in `call' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:205:in `block in execute' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:200:in `each' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:200:in `execute' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:158:in `block in invoke_with_call_chain' C:/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:151:in `invoke_with_call_chain' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/task. rb:144:in `invoke' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:116:in `invoke_task' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:94:in `block (2 levels) in top_level' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:94:in `each' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:94:in `block in top_level' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:133:in `standard_exception_handling' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:88:in `top_level' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:66:in `block in run' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:133:in `standard_exception_handling' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/lib/rake/appli cation.rb:63:in `run' C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rake-0.9.2.2/bin/rake:33:in `<top (required)>' C:/RailsInstaller/Ruby1.9.3/bin/rake:19:in `load' C:/RailsInstaller/Ruby1.9.3/bin/rake:19:in `<main>' Tasks: TOP => db:migrate
Since it passes through config, that makes me think my database.yml file is fine. But if it can't connect to localhost then I guess it's not? Here it is:
development: adapter: mysql2 encoding: utf8 reconnect: false database: myblog_dev pool: 5 username: root password: 128dh47db7 host: localhost port: 3306 test: adapter: mysql encoding: utf8 reconnect: false database: myblog_dev pool: 5 username: root password: 128dh47db7 host: localhost port: 3306 production: adapter: mysql encoding: utf8 reconnect: false database: myblog_dev pool: 5 username: root password: 128dh47db7 host: localhost port: 3306
MySQL is by default, set to port 3306, and I made sure that it was set to that port when I installed it for a second time. That was before these codes though, so these codes are accurate for what's going on right now.
I have all the gems for rails, and mysql installed. And my Gemfile for the project
mybloglooks like this:
source 'https://rubygems.org' gem 'rails', '3.2.1' # Bundle edge Rails instead: # gem 'rails', :git => 'git://github.com/rails/rails.git' gem 'sqlite3' gem 'mysql2' gem 'eventmachine', '> 1.0.0.beta.4.1' gem 'thin' # Gems used only for assets and not required # in production environments by default. group :assets do gem 'sass-rails', '~> 3.2.3' gem 'coffee-rails', '~> 3.2.1' # See https://github.com/sstephenson/execjs#readme for more supported runtimes # gem 'therubyracer' gem 'uglifier', '>= 1.0.3' end gem 'jquery-rails'
Is there a Gemfile I'm supposed to edit thats not my project 'myblogs's Gemfile?
It's not MySQL because I can connect to my database just fine.
mysql> connect myblog_dev Connection id: 8 Current database: myblog_dev
I've also looked over countless forums of people who have had the same problem, but none of their fixes worked for me, or they werent defined because once the person figured it out they didnt detail how they fixed it.
This is extremely frustrating. I know I can just use sqlite3 for dev purposes, but i really wanted to learn how to set up MySQL as soon as I could, so I could get it out of the way.
I havent even been able to write any of my own code yet.
Can anyone please help me? I would be so extremely grateful.
Oh, and i have Ruby 1.9.3

New Topic/Question
Reply


MultiQuote





|