user1900791
user1900791

Reputation: 59

Setting up mysql with RoR, had XAMPP

I just got my RoR environment all set up and running. I made my first application with sqlite. I now want to try Mysql. I have XAMPP from when I did a bit of PHP over a year ago, therefor MYSQL is installed. I now want to set up my applications with mysql. I am setting mysql to start from the XAMPP conrol panel. Go to my application and type 'gem install mysql' to get started but I get:

Fetching: mysql-2.9.0.gem (100%) ERROR: While executing gem ... (Errno::EACCES) Permission denied - /Users/lambert/.rvm/gems/ruby-1.9.3-p362/cache/mysql-2.9.0.gem

Any ideas, my next step would be to uninstall my XAMPP installation altogether and download mysql, get started from scratch and follow the tutorials all over the web. But if it can be kept...

Upvotes: 1

Views: 1105

Answers (2)

ѕтƒ
ѕтƒ

Reputation: 3647

You have to install mysql2 adapter for working mysql with RoR.
Use this command to install the adapter.

gem install mysql2

then create the project with

rails new MyProject -d mysql

this will create your project with MySQL as database. after that in database.yml file you can edit your username, password for MySQL.

Upvotes: 3

Rodrigo Assis
Rodrigo Assis

Reputation: 131

I don't think you need XAMPP to use MySQL with RoR.

Put this in your gemfile:

gem 'mysql2'

Run bundle install on the console.

And set up the credentials on database.yml file like this:

development:
  adapter: mysql2
  encoding: utf8
  database: your_database_name_development
  username: username
  password: password

And see if it works, run on the console:

rake db:create
rake db:migrate

Hope I could help!

Upvotes: 0

Related Questions