Can anyone please give the steps(commands) how to connect ruby on rails
to MySQl in fedora8.
I have installed MySQL and Ruby in my system.
Please specify any further installations to be done
Reply will be appreciated.
Can anyone please give the steps(commands) how to connect ruby on rails
to MySQl in fedora8.
I have installed MySQL and Ruby in my system.
Please specify any further installations to be done
Reply will be appreciated.
Nik K. wrote:
Can anyone please give the steps(commands) how to connect ruby on rails
to MySQl in fedora8.I have installed MySQL and Ruby in my system.
Please specify any further installations to be done
Reply will be appreciated.
http://www.google.com/search?q=rails+mysql
I’m not sure if it’s the same for all OS, but you can try this:
your_app/config/database.yml
development:
adapter: mysql
database: your_database
username: user
password: password
test:
adapter: mysql
database: your_database_test
username: user
password: password
production:
adapter: mysql
database: your_database_production
username: user
password: password
Mukund wrote:
Install the following gems.
- Rails
- MySQL (try sudo gem install mysql – --with-mysql-config=/usr/bin/
mysql-config if the normal sudo gem install mysql fails)Once both of those are successful, you can configure database.yml to
point to a valid schema a try it out.On Jun 15, 3:23�am, Nik K. [email protected]
Thanks to ur reply…
One more question is how to configure database.yml.
Le Sa wrote:
Nik K. wrote:
Can anyone please give the steps(commands) how to connect ruby on rails
to MySQl in fedora8.I have installed MySQL and Ruby in my system.
Please specify any further installations to be done
Reply will be appreciated.
http://www.google.com/search?q=rails+mysql
I’m not sure if it’s the same for all OS, but you can try this:
your_app/config/database.ymlSQLite version 3.x
gem install sqlite3-ruby (not necessary on OS X Leopard)
development:
adapter: mysql
database: your_database
username: user
password: passwordWarning: 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: mysql
database: your_database_test
username: user
password: passwordproduction:
adapter: mysql
database: your_database_production
username: user
password: password
I have tried this in my system(fedora 8) and I am getting this error
[root@xenhost]# SQLite version 3.x
bash: SQLite: command not found
[root@xenhost]# gem install sqlite3-ruby
Building native extensions. This could take a while…
ERROR: Error installing sqlite3-ruby:
ERROR: Failed to build gem native extension.
/usr/bin/ruby extconf.rb
checking for fdatasync() in -lrt… no
checking for sqlite3.h… no
make
make: *** No rule to make target ruby.h', needed by
sqlite3_api_wrap.o’. Stop.
Gem files will remain installed in
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection.
Results logged to
/usr/lib/ruby/gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out
Install the following gems.
Once both of those are successful, you can configure database.yml to
point to a valid schema a try it out.
On Jun 15, 3:23 am, Nik K. [email protected]
On Mon, Jun 15, 2009 at 2:04 AM, Nik
Kumar[email protected] wrote:
I have tried this in my system(fedora 8) and I am getting this error
[root@xenhost]# SQLite version 3.x
bash: SQLite: command not found
[root@xenhost]# gem install sqlite3-ruby
Why are you doing this if you want to use MySQL?
–
Hassan S. ------------------------ [email protected]
NIk,
Are all these installed on your pc: libdbd-sqlite3-ruby sqlite3
libsqlite3-dev libsqlite3-ruby
2009/6/15 Nik K. [email protected]
Reply will be appreciated.
username: user[root@xenhost]# gem install sqlite3-ruby
`sqlite3_api_wrap.o’. Stop.
–
Regards,
Amit K.
Sr. Software Engrr
+91 9890654102
+91 9373087399
Blogsite: http://amitbaraik.blog.co.in/
Nik, Le Sa had explained you how to configure the databases.yml.
Follow his instructions, but keep in mind that you would have to
configure the socket (if your mySQL server have one) and maybe your
mySQL host and port. For development and testing environment you
should use sqlite but in production you’ll like a more robust database
engine.
Sample configuration for a production environment:
production:
adapter: mysql
database: your_database_production
username: your_mySQL_user
password: your_mySQL_password
socket: /path/to/your/socket
host: /your/mySQL/host (probably localhost)
port: your_mySQL_port
On Jun 15, 11:03 am, Nik K. [email protected]
Let’s go back to the beginning here…
First, you said you are using redhat and you said you already have mysql
installed and rails installed. In that case you just need to have the
gem installed.
The gem is the hard part, depending on which “ruby” version you are
using. So, try the following first:
sudo gem install mysql
… if you get failures installing that gem and you are using ruby 1.9.x
…
Do…
sudo gem install hectoregm-mysql-ruby
Once any of those gems installs… test to make sure it works…
Run IRB
type require ‘mysql’
The output should show => True
…
If you get this far then you just need to create your new project and
specify that you want to use mysql. You can do this a few ways. First
way is if you have a really good IDE (the IDE will do it for you when
you create your project (netbeans for example does this). The second
way is to specify your database in the database.yml file.
development:
adapter: mysql
encoding: utf8
reconnect: false
database: name_of_your_database_here
pool: 5
username: root
password:
host: localhost
Then you need to run a rake DB create task to create the database based
on the specifications of the database.yml file.
rake db:create (which works for the current environment database
specified)
… or …
rake db:create:all (which creates all databases specified in
database.yml)
Hope that helps.
Thank u Älphä Blüë
I have a doubt please clarify…
How do we know the contents of the database.yml file.
does this command is the right one to use $vim /configure/database.yml
One more thing I am getting this thing if i go for rake
$rake db:migrate
rake aborted!
No Rakefile found (looking for: rakefile, Rakefile, rakefile.rb,
Rakefile.rb)
/usr/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2377:in
`raw_load_rakefile’
(See full trace by running task with --trace)
Nik K. wrote in post #826714:
Can anyone please give the steps(commands) how to connect ruby on rails
to MySQl in fedora8.I have installed MySQL and Ruby in my system.
Please specify any further installations to be done
Reply will be appreciated.
Set MySQL from the start
$ rails -d mysql app_name
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs