I got interested in Ruby on Rails a few weeks ago. I am running on a MacBook Pro with OS 10.6.
Ruby version 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.6.0]
Rails version 3.0.5
gem version 1.7.1
MySQL Version 5.5.10, for osx10.6 (i386) using readline 5.1.
I have a migration ready to go, however, when I run rake db:migrate
I get the following error:
Could not find mysql2-0.2.7 in any of the sources
I have run sudo gem install mysql2
and it completes successfully. The missing "package" is installed in /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.开发者_运维百科7
. Any ideas all?
Try changing "mysql2" to "mysql" or vise versa in database.yml
Note : I have performed below steps on my Linux machine , so please use the commands
equivalent to your mac os
for apt-get
etc .
Just follow the steps below and you will be able to solve your error :
Install mysql-server using command :
sudo apt-get install mysql-server-5.5
After that , just run below commands in your terminal :
sudo service mysql stop
sudo /etc/init.d/apparmor reload
sudo service mysql start
Now , run the command mysql -u root -p
, you will successfully enter into the mysql
command prompt.
I hope this helps. :)
精彩评论